Beispiel #1
0
        public static void GenerateContemporaryDocument2(string strPortfolioID, bool blProfileTable, string strUserLanguage, string strPortTypeID, string strPortSettingTable)
        {
            DataTable dtPortfolio, dtEdu, dtWork, dtComm, dtAward, dtHobby, dtSkill, dtRef, dtOrg;
            string strPersonalInfo, strWorkExp, strCommunityHrs, strExtraOrg, strInterHobbies, strAdditionalInfo;//user info settings
            string[] arrResumeSections;
            int intMenuGrade;

            if (blProfileTable)
            {
                dtPortfolio = CCLib.Common.DataAccess.GetDataTable("select * from Port_ResumeBuilder_View where PortfolioID=" + strPortfolioID);
            }
            else
            {
                dtPortfolio = CCLib.Common.DataAccess.GetDataTable("select * from Portfolio where PortfolioID=" + strPortfolioID);

            }

            DataRow drPortSettings = CCLib.Login.GetPortSettings(strPortfolioID);

            arrResumeSections = CCLib.Common.Resume.GetSections(dtPortfolio, drPortSettings, blProfileTable);

            if (dtPortfolio.Rows.Count > 0)
            {
                switch (dtPortfolio.Rows[0]["GradeNumber"].ToString())
                {
                    case "1":
                        intMenuGrade = 5;
                        break;
                    case "2":
                        intMenuGrade = 5;
                        break;
                    case "3":
                        intMenuGrade = 5;
                        break;
                    case "4":
                        intMenuGrade = 5;
                        break;
                    case "5":
                        intMenuGrade = 5;
                        break;
                    case "6":
                        intMenuGrade = 6;
                        break;
                    case "7":
                        intMenuGrade = 7;
                        break;
                    case "8":
                        intMenuGrade = 8;
                        break;
                    case "9":
                        intMenuGrade = 9;
                        break;
                    case "10":
                        intMenuGrade = 10;
                        break;
                    case "11":
                        intMenuGrade = 11;
                        break;
                    case "12":
                        intMenuGrade = 12;
                        break;
                    case "13":
                        intMenuGrade = 13;
                        break;
                    case "30":
                        intMenuGrade = 13;
                        break;
                    case "40":
                        intMenuGrade = 13;
                        break;
                    case "50":
                        intMenuGrade = 13;
                        break;
                    case "60":
                        intMenuGrade = 13;
                        break;
                    case "70":
                        intMenuGrade = 13;
                        break;
                    default:
                        intMenuGrade = 6;
                        break;

                }
                if (blProfileTable)
                {
                    strPersonalInfo = drPortSettings["RBPersonalProfile" + intMenuGrade].ToString();
                    strWorkExp = drPortSettings["RBWorkExp" + intMenuGrade].ToString();
                    strCommunityHrs = drPortSettings["RBCommunity" + intMenuGrade].ToString();
                    strExtraOrg = drPortSettings["RBOrganizations" + intMenuGrade].ToString();
                    strInterHobbies = drPortSettings["RBHobbies" + intMenuGrade].ToString();
                    strAdditionalInfo = drPortSettings["RBAdditionalInfo" + intMenuGrade].ToString();
                }
                else
                {
                    strPersonalInfo = drPortSettings["PersonalProfile" + intMenuGrade].ToString();
                    strWorkExp = drPortSettings["RBWorkExp" + intMenuGrade].ToString();
                    strCommunityHrs = drPortSettings["RBCommunity" + intMenuGrade].ToString();
                    strExtraOrg = drPortSettings["RBOrganizations" + intMenuGrade].ToString();
                    strInterHobbies = drPortSettings["RBHobbies" + intMenuGrade].ToString();
                    strAdditionalInfo = drPortSettings["RBAdditionalInfo" + intMenuGrade].ToString();
                }

                #region Build Resume
                byte c = 187; // for extended ASCII ">>"
                char ch = (char)c;

                /* Initialize the WordApplication and create our document. */
                WordApplication wordApp = new WordApplication();
                Document doc = wordApp.Create();

                //Create tblMain and tblContactInfo tables to keep consistent margin
                Table tblMain = doc.InsertTableAfter(1, 1);
                Table tblContactInfo = tblMain[tblMain.NumRows - 1, 0].InsertTableAfter(2, 1);

                if (strPersonalInfo == "True")
                {
                    Font fInfo = doc.CreateFont();
                    fInfo.FontName = "Garamond";
                    fInfo.FontSize = 9;
                    ParagraphFormatting pf = doc.CreateParagraphFormatting();
                    pf.TextJustification = ParagraphFormatting.Justification.Center;

                    // Add contact information to the document
                    if (dtPortfolio.Rows[0]["FirstName"].ToString().Trim() != "" && dtPortfolio.Rows[0]["LastName"].ToString().Trim() != "")
                    {
                        string sName = dtPortfolio.Rows[0]["FirstName"].ToString() + " " + dtPortfolio.Rows[0]["LastName"].ToString();
                        Font fName = doc.CreateFont();
                        fName.FontName = "Garamond";
                        fName.FontSize = 18;
                        fName.Bold = true;
                        tblContactInfo[0, 0].ApplyParagraphFormatting(pf);
                        tblContactInfo[0, 0].VertAlignment = TableCell.VerticalAlignment.Top;
                        tblContactInfo.set_RowHeight(0, 450);
                        tblContactInfo.set_RowHeightExact(0, false);
                        tblContactInfo[0, 0].InsertTextAfter(sName, fName);
                    }

                    tblContactInfo[1, 0].ApplyParagraphFormatting(pf);
                    if (dtPortfolio.Rows[0]["Address1"].ToString().Trim() != "")
                    {
                        tblContactInfo[1, 0].InsertTextAfter(dtPortfolio.Rows[0]["Address1"].ToString(), fInfo);
                        if (dtPortfolio.Rows[0]["Address2"].ToString().Trim() != "")
                            tblContactInfo[1, 0].InsertTextAfter(", " + dtPortfolio.Rows[0]["Address2"].ToString(), fInfo);
                        tblContactInfo[1, 0].InsertBreakAfter(Element.BreakType.TextWrap);
                    }
                    if (dtPortfolio.Rows[0]["City"].ToString().Trim() != "")
                        tblContactInfo[1, 0].InsertTextAfter(dtPortfolio.Rows[0]["City"].ToString(), fInfo);
                    if (dtPortfolio.Rows[0]["StateProv"].ToString().Trim() != "")
                        tblContactInfo[1, 0].InsertTextAfter(", " + dtPortfolio.Rows[0]["StateProv"].ToString(), fInfo);
                    if (dtPortfolio.Rows[0]["PostalZip"].ToString().Trim() != "")
                        tblContactInfo[1, 0].InsertTextAfter(" " + dtPortfolio.Rows[0]["PostalZip"].ToString(), fInfo);
                    tblContactInfo[1, 0].InsertBreakAfter(Element.BreakType.TextWrap);
                    if (dtPortfolio.Rows[0]["Phone"].ToString().Trim() != "")
                    {
                        tblContactInfo[1, 0].InsertTextAfter(dtPortfolio.Rows[0]["Phone"].ToString(), fInfo);
                        tblContactInfo[1, 0].InsertBreakAfter(Element.BreakType.TextWrap);
                    }
                    if (dtPortfolio.Rows[0]["EmailAddress"].ToString().Trim() != "")
                    {
                        string strUrl = (dtPortfolio.Rows[0]["EmailAddress"].ToString());
                        tblContactInfo[1, 0].InsertTextAfter(dtPortfolio.Rows[0]["EmailAddress"].ToString(), fInfo);
                        tblContactInfo[1, 0].InsertBreakAfter(Element.BreakType.TextWrap);
                    }
                    if (dtPortfolio.Rows[0]["WebAddress"].ToString().Trim() != "")
                    {
                        string strUrl = (dtPortfolio.Rows[0]["WebAddress"].ToString().IndexOf("HTTP") == -1) ? "HTTP://" + dtPortfolio.Rows[0]["WebAddress"].ToString() : dtPortfolio.Rows[0]["WebAddress"].ToString();
                        tblContactInfo[1, 0].InsertTextAfter(dtPortfolio.Rows[0]["WebAddress"].ToString(), fInfo);
                    }
                    tblMain[0, 0].InsertBreakAfter(Element.BreakType.TextWrap);
                }

                if (arrResumeSections != null)
                {
                    DataSet dsSections = CCLib.Common.Resume.GetSectionsDetail(arrResumeSections, strPortfolioID, strPortTypeID, strUserLanguage);
                    for (int i = 0; i < arrResumeSections.Length; i++)
                    {
                        Font fBold = doc.CreateFont();
                        fBold.FontName = "Garamond";
                        fBold.FontSize = 10;
                        fBold.Bold = true;
                        Font fText = doc.CreateFont();
                        fText.FontName = "Garamond";
                        fText.FontSize = 9;
                        Font fTextStrong = doc.CreateFont();
                        fTextStrong.FontName = "Garamond";
                        fTextStrong.FontSize = 9;
                        fTextStrong.Italic = true;
                        fTextStrong.Bold = true;
                        Font fBullet = doc.CreateFont();
                        //fBullet.FontName = "Haettenschweiler";
                        fBullet.FontSize = 10;
                        fBullet.Bold = true;
                        Font fWhite = doc.CreateFont();
                        fWhite.FontName = "Garamond";
                        fWhite.FontSize = 10;
                        fWhite.TextColor = System.Drawing.Color.White;

                        switch (arrResumeSections[i].ToString())
                        {
                            case "CareerObjective":
                                if (dtPortfolio.Rows[0]["CareerObjective"].ToString() != "")
                                {
                                    tblMain.AddRows(1);
                                    Table tblCO = tblMain[tblMain.NumRows - 1, 0].InsertTableAfter(3, 1);
                                    TableCell Cell1 = tblCO[0, 0];
                                    Cell1.VertAlignment = TableCell.VerticalAlignment.Top;
                                    tblCO.set_RowHeight(0, 350);
                                    tblCO.set_RowHeightExact(0, true);
                                    Cell1.InsertTextAfter(CCLib.Common.Strings.GeneratelanguageText(2876, strUserLanguage), fBold);

                                    TableCell Cell2 = tblCO[1, 0];
                                    Cell2.VertAlignment = TableCell.VerticalAlignment.Top;
                                    InlineImage imgLine1 = Cell2.InsertImageBefore(ConfigurationManager.AppSettings["strMediaLocation"] + "portfolio_tool\\line.gif");
                                    imgLine1.Width = 8600;
                                    imgLine1.Height = 20;
                                    Cell2.InsertTextAfter("----", fWhite);

                                    TableCell Cell3 = tblCO[2, 0];
                                    Cell3.InsertTextAfter(dtPortfolio.Rows[0]["CareerObjective"].ToString(), fText);
                                    tblMain[tblMain.NumRows - 1, 0].InsertBreakAfter(Element.BreakType.TextWrap);
                                }
                                break;
                            case "WorkExperience":
                                if (strWorkExp == "True")
                                {
                                    if (dsSections.Tables["WorkExperience"] != null)
                                    {
                                        dtWork = dsSections.Tables["WorkExperience"];
                                        if (dtWork.Rows.Count > 0)
                                        {
                                            tblMain.AddRows(1);
                                            Table tblWE = tblMain[tblMain.NumRows - 1, 0].InsertTableAfter(dtWork.Rows.Count + 2, 2);
                                            TableCell Cell4 = tblWE[0, 0];
                                            Cell4.CellWidthUnits = TableCell.WidthUnits.Percentage;
                                            Cell4.PreferredWidth = 20;
                                            tblWE[0, 1].CellWidthUnits = TableCell.WidthUnits.Percentage;
                                            tblWE[0, 1].PreferredWidth = 80;
                                            Cell4.FirstMerged = true;
                                            tblWE[0, 1].Merged = true;
                                            Cell4.VertAlignment = TableCell.VerticalAlignment.Top;
                                            tblWE.set_RowHeight(0, 350);
                                            tblWE.set_RowHeightExact(0, true);
                                            Cell4.InsertTextAfter(CCLib.Common.Strings.GeneratelanguageText(2878, strUserLanguage), fBold);

                                            TableCell Cell5 = tblWE[1, 0];
                                            Cell5.FirstMerged = true;
                                            tblWE[1, 1].Merged = true;
                                            Cell5.VertAlignment = TableCell.VerticalAlignment.Top;
                                            InlineImage imgLine2 = Cell5.InsertImageBefore(ConfigurationManager.AppSettings["strMediaLocation"] + "portfolio_tool\\line.gif");
                                            imgLine2.Width = 8600;
                                            imgLine2.Height = 20;
                                            Cell5.InsertTextAfter("----", fWhite);

                                            for (int j = 0; j < dtWork.Rows.Count; j++)
                                            {
                                                tblWE[j + 2, 0].CellWidthUnits = TableCell.WidthUnits.Percentage;
                                                tblWE[j + 2, 0].PreferredWidth = 20;
                                                if (dtWork.Rows[j]["StartMonthID"].ToString() != "0" && dtWork.Rows[j]["StartMonthID"].ToString() != "")
                                                    tblWE[j + 2, 0].InsertTextAfter(CCLib.Common.Strings.GetShortMonth(Convert.ToInt32(dtWork.Rows[j]["StartMonthID"]), strUserLanguage) + " " + dtWork.Rows[j]["StartYear"].ToString().Substring(2, 2) + " - ", fText);
                                                if (dtWork.Rows[j]["EndMonthID"].ToString() != "" && dtWork.Rows[j]["EndMonthID"].ToString() != "0")
                                                {
                                                    if (dtWork.Rows[j]["EndMonthID"].ToString().Trim() == "13")
                                                        tblWE[j + 2, 0].InsertTextAfter(CCLib.Common.Strings.GeneratelanguageText(2879, strUserLanguage), fText);
                                                    else
                                                        tblWE[j + 2, 0].InsertTextAfter(CCLib.Common.Strings.GetShortMonth(Convert.ToInt32(dtWork.Rows[j]["EndMonthID"]), strUserLanguage) + " " + dtWork.Rows[j]["EndYear"].ToString().Substring(2, 2), fText);
                                                }
                                                tblWE[j + 2, 1].CellWidthUnits = TableCell.WidthUnits.Percentage;
                                                tblWE[j + 2, 1].PreferredWidth = 80;
                                                tblWE[j + 2, 1].InsertTextAfter(dtWork.Rows[j]["Title"].ToString() + ", ", fTextStrong);
                                                tblWE[j + 2, 1].InsertTextAfter(dtWork.Rows[j]["Company"].ToString(), fText);
                                                tblWE[j + 2, 1].InsertBreakAfter(Element.BreakType.TextWrap);
                                                tblWE[j + 2, 1].InsertTextAfter(dtWork.Rows[j]["City"].ToString(), fText);
                                                if ((dtWork.Rows[j]["City"].ToString() != "") && (dtWork.Rows[j]["StateProv"].ToString() != ""))
                                                { tblWE[j + 2, 1].InsertTextAfter(", ", fText); }
                                                tblWE[j + 2, 1].InsertTextAfter(dtWork.Rows[j]["StateProv"].ToString(), fText);
                                                if (dtWork.Rows[j]["ExpDesc"].ToString() != "")
                                                {
                                                    tblWE[j + 2, 1].InsertBreakAfter(Element.BreakType.TextWrap);
                                                    tblWE[j + 2, 1].InsertBreakAfter(Element.BreakType.TextWrap);
                                                    //tblWE[j + 2, 1].InsertTextAfter(ch.ToString() + " ", fBullet);
                                                    tblWE[j + 2, 1].InsertTextAfter("» " + dtWork.Rows[j]["ExpDesc"].ToString().Replace("\n", "\n» "), fText);
                                                }
                                                if (j < dtWork.Rows.Count - 1)
                                                    tblWE[j + 2, 1].InsertBreakAfter(Element.BreakType.TextWrap);
                                            }
                                            tblMain[tblMain.NumRows - 1, 0].InsertBreakAfter(Element.BreakType.TextWrap);
                                        }
                                    }
                                }
                                break;
                            case "Education":
                                if (drPortSettings["RBEducation" + intMenuGrade].ToString() == "True")
                                {
                                    if (dsSections.Tables["Education"] != null)
                                    {
                                        dtEdu = dsSections.Tables["Education"];
                                        if (dtEdu.Rows.Count > 0)
                                        {
                                            tblMain.AddRows(1);
                                            Table tblEdu = tblMain[tblMain.NumRows - 1, 0].InsertTableAfter(dtEdu.Rows.Count + 2, 2);
                                            TableCell Cell6 = tblEdu[0, 0];
                                            Cell6.CellWidthUnits = TableCell.WidthUnits.Percentage;
                                            Cell6.PreferredWidth = 20;
                                            tblEdu[0, 1].CellWidthUnits = TableCell.WidthUnits.Percentage;
                                            tblEdu[0, 1].PreferredWidth = 80;
                                            Cell6.FirstMerged = true;
                                            tblEdu[0, 1].Merged = true;
                                            Cell6.VertAlignment = TableCell.VerticalAlignment.Top;
                                            tblEdu.set_RowHeight(0, 350);
                                            tblEdu.set_RowHeightExact(0, true);
                                            Cell6.InsertTextAfter(CCLib.Common.Strings.GeneratelanguageText(2877, strUserLanguage), fBold);

                                            TableCell Cell7 = tblEdu[1, 0];
                                            Cell7.FirstMerged = true;
                                            tblEdu[1, 1].Merged = true;
                                            Cell7.VertAlignment = TableCell.VerticalAlignment.Top;
                                            InlineImage imgLine3 = Cell7.InsertImageBefore(ConfigurationManager.AppSettings["strMediaLocation"] + "portfolio_tool\\line.gif");
                                            imgLine3.Width = 8600;
                                            imgLine3.Height = 20;
                                            Cell7.InsertTextAfter("----", fWhite);

                                            for (int j = 0; j < dtEdu.Rows.Count; j++)
                                            {
                                                tblEdu[j + 2, 0].CellWidthUnits = TableCell.WidthUnits.Percentage;
                                                tblEdu[j + 2, 0].PreferredWidth = 20;
                                                if (dtEdu.Rows[j]["StartMonthID"].ToString() != "0" && dtEdu.Rows[j]["StartMonthID"].ToString() != "")
                                                    tblEdu[j + 2, 0].InsertTextAfter(CCLib.Common.Strings.GetShortMonth(Convert.ToInt32(dtEdu.Rows[j]["StartMonthID"]), strUserLanguage) + " " + dtEdu.Rows[j]["StartYear"].ToString().Substring(2, 2) + " - ", fText);
                                                if (dtEdu.Rows[j]["EndMonthID"].ToString() != "" && dtEdu.Rows[j]["EndMonthID"].ToString() != "0")
                                                {
                                                    if (dtEdu.Rows[j]["EndMonthID"].ToString().Trim() == "13")
                                                        tblEdu[j + 2, 0].InsertTextAfter(CCLib.Common.Strings.GeneratelanguageText(2879, strUserLanguage), fText);
                                                    else
                                                        tblEdu[j + 2, 0].InsertTextAfter(CCLib.Common.Strings.GetShortMonth(Convert.ToInt32(dtEdu.Rows[j]["EndMonthID"]), strUserLanguage) + " " + dtEdu.Rows[j]["EndYear"].ToString().Substring(2, 2), fText);
                                                }
                                                tblEdu[j + 2, 1].CellWidthUnits = TableCell.WidthUnits.Percentage;
                                                tblEdu[j + 2, 1].PreferredWidth = 80;
                                                tblEdu[j + 2, 1].InsertTextAfter(dtEdu.Rows[j]["Degree"].ToString() + ", ", fTextStrong);
                                                tblEdu[j + 2, 1].InsertTextAfter(dtEdu.Rows[j]["School"].ToString(), fText);
                                                tblEdu[j + 2, 1].InsertBreakAfter(Element.BreakType.TextWrap);
                                                tblEdu[j + 2, 1].InsertTextAfter(dtEdu.Rows[j]["City"].ToString(), fText);
                                                if ((dtEdu.Rows[j]["City"].ToString() != "") && (dtEdu.Rows[j]["StateProv"].ToString() != ""))
                                                { tblEdu[j + 2, 1].InsertTextAfter(", ", fText); }
                                                tblEdu[j + 2, 1].InsertTextAfter(dtEdu.Rows[j]["StateProv"].ToString(), fText);
                                                if (dtEdu.Rows[j]["EduDesc"].ToString() != "")
                                                {
                                                    tblEdu[j + 2, 1].InsertBreakAfter(Element.BreakType.TextWrap);
                                                    tblEdu[j + 2, 1].InsertBreakAfter(Element.BreakType.TextWrap);
                                                    tblEdu[j + 2, 1].InsertTextAfter(ch.ToString() + " ", fBullet);
                                                    tblEdu[j + 2, 1].InsertTextAfter(dtEdu.Rows[j]["EduDesc"].ToString(), fText);
                                                }
                                                if (j < dtEdu.Rows.Count - 1)
                                                    tblEdu[j + 2, 1].InsertBreakAfter(Element.BreakType.TextWrap);
                                            }
                                            tblMain[tblMain.NumRows - 1, 0].InsertBreakAfter(Element.BreakType.TextWrap);
                                        }
                                    }
                                }
                                break;
                            case "VolunteerExperience":
                                if (strCommunityHrs == "True")
                                {
                                    if (dsSections.Tables["VolunteerExperience"] != null)
                                    {
                                        dtComm = dsSections.Tables["VolunteerExperience"];
                                        if (dtComm.Rows.Count > 0)
                                        {
                                            tblMain.AddRows(1);
                                            Table tblVol = tblMain[tblMain.NumRows - 1, 0].InsertTableAfter(dtComm.Rows.Count + 2, 2);
                                            TableCell Cell8 = tblVol[0, 0];
                                            Cell8.CellWidthUnits = TableCell.WidthUnits.Percentage;
                                            Cell8.PreferredWidth = 20;
                                            tblVol[0, 1].CellWidthUnits = TableCell.WidthUnits.Percentage;
                                            tblVol[0, 1].PreferredWidth = 80;
                                            Cell8.FirstMerged = true;
                                            tblVol[0, 1].Merged = true;
                                            Cell8.VertAlignment = TableCell.VerticalAlignment.Top;
                                            tblVol.set_RowHeight(0, 350);
                                            tblVol.set_RowHeightExact(0, true);
                                            Cell8.InsertTextAfter(CCLib.Common.Strings.GenerateLanguageText(5369, strUserLanguage, false, strPortTypeID), fBold);

                                            TableCell Cell9 = tblVol[1, 0];
                                            Cell9.FirstMerged = true;
                                            tblVol[1, 1].Merged = true;
                                            Cell9.VertAlignment = TableCell.VerticalAlignment.Top;
                                            InlineImage imgLine4 = Cell9.InsertImageBefore(ConfigurationManager.AppSettings["strMediaLocation"] + "portfolio_tool\\line.gif");
                                            imgLine4.Width = 8600;
                                            imgLine4.Height = 20;
                                            Cell9.InsertTextAfter("----", fWhite);

                                            for (int j = 0; j < dtComm.Rows.Count; j++)
                                            {
                                                tblVol[j + 2, 0].CellWidthUnits = TableCell.WidthUnits.Percentage;
                                                tblVol[j + 2, 0].PreferredWidth = 20;
                                                if (dtComm.Rows[j]["StartMonthID"].ToString() != "0" && dtComm.Rows[j]["StartMonthID"].ToString() != "")
                                                    tblVol[j + 2, 0].InsertTextAfter(CCLib.Common.Strings.GetShortMonth(Convert.ToInt32(dtComm.Rows[j]["StartMonthID"]), strUserLanguage) + " " + dtComm.Rows[j]["StartYear"].ToString().Substring(2, 2) + " - ", fText);
                                                if (dtComm.Rows[j]["EndMonthID"].ToString() != "" && dtComm.Rows[j]["EndMonthID"].ToString() != "0")
                                                {
                                                    if (dtComm.Rows[j]["EndMonthID"].ToString().Trim() == "13")
                                                        tblVol[j + 2, 0].InsertTextAfter(CCLib.Common.Strings.GeneratelanguageText(2879, strUserLanguage), fText);
                                                    else
                                                        tblVol[j + 2, 0].InsertTextAfter(CCLib.Common.Strings.GetShortMonth(Convert.ToInt32(dtComm.Rows[j]["EndMonthID"]), strUserLanguage) + " " + dtComm.Rows[j]["EndYear"].ToString().Substring(2, 2), fText);
                                                }
                                                tblVol[j + 2, 1].CellWidthUnits = TableCell.WidthUnits.Percentage;
                                                tblVol[j + 2, 1].PreferredWidth = 80;
                                                tblVol[j + 2, 1].InsertTextAfter(dtComm.Rows[j]["Title"].ToString() + ", ", fTextStrong);
                                                tblVol[j + 2, 1].InsertTextAfter(dtComm.Rows[j]["Company"].ToString(), fText);
                                                tblVol[j + 2, 1].InsertBreakAfter(Element.BreakType.TextWrap);
                                                tblVol[j + 2, 1].InsertTextAfter(dtComm.Rows[j]["City"].ToString(), fText);
                                                if ((dtComm.Rows[j]["City"].ToString() != "") && (dtComm.Rows[j]["StateProv"].ToString() != ""))
                                                { tblVol[j + 2, 1].InsertTextAfter(", ", fText); }
                                                tblVol[j + 2, 1].InsertTextAfter(dtComm.Rows[j]["StateProv"].ToString(), fText);
                                                if (dtComm.Rows[j]["ExpDesc"].ToString() != "")
                                                {
                                                    tblVol[j + 2, 1].InsertBreakAfter(Element.BreakType.TextWrap);
                                                    tblVol[j + 2, 1].InsertBreakAfter(Element.BreakType.TextWrap);
                                                    //tblVol[j + 2, 1].InsertTextAfter(ch.ToString() + " ", fBullet);
                                                    tblVol[j + 2, 1].InsertTextAfter("» " + dtComm.Rows[j]["ExpDesc"].ToString().Replace("\n", "\n» "), fText);
                                                }
                                                if (j < dtComm.Rows.Count - 1)
                                                    tblVol[j + 2, 1].InsertBreakAfter(Element.BreakType.TextWrap);
                                            }
                                            tblMain[tblMain.NumRows - 1, 0].InsertBreakAfter(Element.BreakType.TextWrap);
                                        }
                                    }
                                }
                                break;
                            case "Organization":
                                if (strExtraOrg == "True")
                                {
                                    if (dsSections.Tables["Organization"] != null)
                                    {
                                        dtOrg = dsSections.Tables["Organization"];
                                        if (dtPortfolio.Rows[0]["ResumeSections"].ToString().IndexOf("OrgComments") > 0)
                                        {
                                            if (dtOrg.Rows.Count > 0)
                                            {
                                                tblMain.AddRows(1);
                                                Table tblWE = tblMain[tblMain.NumRows - 1, 0].InsertTableAfter(dtOrg.Rows.Count + 2, 2);
                                                TableCell Cell4 = tblWE[0, 0];
                                                Cell4.CellWidthUnits = TableCell.WidthUnits.Percentage;
                                                Cell4.PreferredWidth = 20;
                                                tblWE[0, 1].CellWidthUnits = TableCell.WidthUnits.Percentage;
                                                tblWE[0, 1].PreferredWidth = 80;
                                                Cell4.FirstMerged = true;
                                                tblWE[0, 1].Merged = true;
                                                Cell4.VertAlignment = TableCell.VerticalAlignment.Top;
                                                tblWE.set_RowHeight(0, 350);
                                                tblWE.set_RowHeightExact(0, true);
                                                Cell4.InsertTextAfter(CCLib.Common.Strings.GeneratelanguageText(5399, strUserLanguage), fBold);

                                                TableCell Cell5 = tblWE[1, 0];
                                                Cell5.FirstMerged = true;
                                                tblWE[1, 1].Merged = true;
                                                Cell5.VertAlignment = TableCell.VerticalAlignment.Top;
                                                InlineImage imgLine2 = Cell5.InsertImageBefore(ConfigurationManager.AppSettings["strMediaLocation"] + "portfolio_tool\\line.gif");
                                                imgLine2.Width = 8600;
                                                imgLine2.Height = 20;
                                                Cell5.InsertTextAfter("----", fWhite);

                                                for (int j = 0; j < dtOrg.Rows.Count; j++)
                                                {
                                                    tblWE[j + 2, 0].CellWidthUnits = TableCell.WidthUnits.Percentage;
                                                    tblWE[j + 2, 0].PreferredWidth = 20;
                                                    if (dtOrg.Rows[j]["OrgStartMonth"].ToString() != "0" && dtOrg.Rows[j]["OrgStartMonth"].ToString() != "")
                                                        tblWE[j + 2, 0].InsertTextAfter(CCLib.Common.Strings.GetShortMonth(Convert.ToInt32(dtOrg.Rows[j]["OrgStartMonth"]), strUserLanguage) + " " + dtOrg.Rows[j]["OrgStartYear"].ToString().Substring(2, 2) + " - ", fText);
                                                    if (dtOrg.Rows[j]["OrgEndMonth"].ToString() != "" && dtOrg.Rows[j]["OrgEndMonth"].ToString() != "0")
                                                    {
                                                        if (dtOrg.Rows[j]["OrgEndMonth"].ToString().Trim() == "13")
                                                            tblWE[j + 2, 0].InsertTextAfter(CCLib.Common.Strings.GeneratelanguageText(2879, strUserLanguage), fText);
                                                        else
                                                            tblWE[j + 2, 0].InsertTextAfter(CCLib.Common.Strings.GetShortMonth(Convert.ToInt32(dtOrg.Rows[j]["OrgEndMonth"]), strUserLanguage) + " " + dtOrg.Rows[j]["OrgEndYear"].ToString().Substring(2, 2), fText);
                                                    }
                                                    tblWE[j + 2, 1].CellWidthUnits = TableCell.WidthUnits.Percentage;
                                                    tblWE[j + 2, 1].PreferredWidth = 80;
                                                    tblWE[j + 2, 1].InsertTextAfter(dtOrg.Rows[j]["MyActivity"].ToString(), fText);
                                                    tblWE[j + 2, 1].InsertBreakAfter(Element.BreakType.TextWrap);
                                                    if (dtOrg.Rows[j]["OrgDescription"].ToString() != "")
                                                    {
                                                        tblWE[j + 2, 1].InsertTextAfter(ch.ToString() + " ", fBullet);
                                                        tblWE[j + 2, 1].InsertTextAfter(dtOrg.Rows[j]["OrgDescription"].ToString(), fText);
                                                    }
                                                    if (j < dtOrg.Rows.Count - 1)
                                                        tblWE[j + 2, 1].InsertBreakAfter(Element.BreakType.TextWrap);
                                                }
                                                tblMain[tblMain.NumRows - 1, 0].InsertBreakAfter(Element.BreakType.TextWrap);
                                            }
                                        }
                                        else
                                        {
                                            if (dtOrg.Rows.Count > 0)
                                            {
                                                tblMain.AddRows(1);
                                                Table tblEtr = tblMain[tblMain.NumRows - 1, 0].InsertTableAfter(3, 1);
                                                TableCell Cell12 = tblEtr[0, 0];
                                                Cell12.VertAlignment = TableCell.VerticalAlignment.Top;
                                                tblEtr.set_RowHeight(0, 350);
                                                tblEtr.set_RowHeightExact(0, true);
                                                Cell12.InsertTextAfter(CCLib.Common.Strings.GeneratelanguageText(5399, strUserLanguage), fBold);

                                                TableCell Cell13 = tblEtr[1, 0];
                                                Cell13.VertAlignment = TableCell.VerticalAlignment.Top;
                                                InlineImage imgLine5 = Cell13.InsertImageBefore(ConfigurationManager.AppSettings["strMediaLocation"] + "portfolio_tool\\line.gif");
                                                imgLine5.Width = 8600;
                                                imgLine5.Height = 20;
                                                Cell13.InsertTextAfter("----", fWhite);

                                                string strOrg = "";
                                                for (int m = 0; m < dtOrg.Rows.Count; m++)
                                                {
                                                    strOrg = strOrg + dtOrg.Rows[m]["MyActivity"].ToString() + ", ";
                                                }
                                                if (strOrg.Length > 0)
                                                    strOrg = strOrg.Substring(0, strOrg.Length - 2);
                                                tblEtr[2, 0].InsertTextAfter(strOrg, fText);
                                                tblMain[tblMain.NumRows - 1, 0].InsertBreakAfter(Element.BreakType.TextWrap);
                                            }
                                        }
                                    }
                                }
                                break;
                            case "Award":
                                if (drPortSettings["RBAwards" + intMenuGrade].ToString() == "True")
                                {
                                    if (dsSections.Tables["Award"] != null)
                                    {
                                        dtAward = dsSections.Tables["Award"];
                                        if (dtAward.Rows.Count > 0)
                                        {
                                            tblMain.AddRows(1);
                                            Table tblAwd = tblMain[tblMain.NumRows - 1, 0].InsertTableAfter(dtAward.Rows.Count + 2, 1);
                                            TableCell Cell10 = tblAwd[0, 0];
                                            Cell10.VertAlignment = TableCell.VerticalAlignment.Top;
                                            //Cell10.CellWidthUnits = TableCell.WidthUnits.Percentage;
                                            //Cell10.PreferredWidth = 20;
                                            //tblAwd[0, 1].CellWidthUnits = TableCell.WidthUnits.Percentage;
                                            //tblAwd[0, 1].PreferredWidth = 80;
                                            //Cell10.FirstMerged = true;
                                            //tblAwd[0, 1].Merged = true;
                                            tblAwd.set_RowHeight(0, 350);
                                            tblAwd.set_RowHeightExact(0, true);
                                            Cell10.InsertTextAfter(CCLib.Common.Strings.GeneratelanguageText(5398, strUserLanguage), fBold);

                                            TableCell Cell11 = tblAwd[1, 0];
                                            Cell11.VertAlignment = TableCell.VerticalAlignment.Top;
                                            InlineImage imgLine5 = Cell11.InsertImageBefore(ConfigurationManager.AppSettings["strMediaLocation"] + "portfolio_tool\\line.gif");
                                            imgLine5.Width = 8600;
                                            imgLine5.Height = 20;
                                            Cell11.InsertTextAfter("----", fWhite);

                                            for (int m = 0; m < dtAward.Rows.Count; m++)
                                            {
                                                DateTime d = (DateTime)dtAward.Rows[m]["AwardDate"];
                                                string y = d.Year.ToString().Substring(2, 2);
                                                string mm = CCLib.Common.Strings.GetShortMonth(d.Month, strUserLanguage);
                                                //tblAwd[m + 2, 0].CellWidthUnits = TableCell.WidthUnits.Percentage;
                                                //tblAwd[m + 2, 0].PreferredWidth = 20;
                                                //tblAwd[m + 2, 1].CellWidthUnits = TableCell.WidthUnits.Percentage;
                                                //tblAwd[m + 2, 1].PreferredWidth = 80;
                                                tblAwd[m + 2, 0].VertAlignment = TableCell.VerticalAlignment.Bottom;
                                                //tblAwd[m + 2, 0].InsertTextAfter("", fText);
                                                tblAwd[m + 2, 0].InsertTextAfter(ch.ToString() + " ", fBullet);
                                                tblAwd[m + 2, 0].InsertTextAfter(dtAward.Rows[m]["AwardName"].ToString() + " (" + mm + " " + y + ")", fText);
                                            }
                                            //string strAward = "";
                                            //for (int m = 0; m < dtAward.Rows.Count; m++)
                                            //{
                                            //    strAward = strAward + dtAward.Rows[m]["AwardName"].ToString() + ", ";
                                            //}
                                            //if (strAward.Length > 0)
                                            //    strAward = strAward.Substring(0, strAward.Length - 2);
                                            tblMain[tblMain.NumRows - 1, 0].InsertBreakAfter(Element.BreakType.TextWrap);
                                        }
                                    }
                                }
                                break;
                            case "Extracurricular":
                                if (strInterHobbies == "True")
                                {
                                    if (dsSections.Tables["Extracurricular"] != null)
                                    {
                                        dtHobby = dsSections.Tables["Extracurricular"];
                                        if (dtPortfolio.Rows[0]["ResumeSections"].ToString().IndexOf("ExtraComments") > 0)
                                        {
                                            if (dtHobby.Rows.Count > 0)
                                            {
                                                tblMain.AddRows(1);
                                                Table tblEtr = tblMain[tblMain.NumRows - 1, 0].InsertTableAfter(dtHobby.Rows.Count + 2, 1);
                                                TableCell Cell12 = tblEtr[0, 0];
                                                Cell12.VertAlignment = TableCell.VerticalAlignment.Top;
                                                tblEtr.set_RowHeight(0, 350);
                                                tblEtr.set_RowHeightExact(0, true);
                                                Cell12.InsertTextAfter(CCLib.Common.Strings.GeneratelanguageText(4037, strUserLanguage), fBold);

                                                TableCell Cell13 = tblEtr[1, 0];
                                                Cell13.VertAlignment = TableCell.VerticalAlignment.Top;
                                                InlineImage imgLine5 = Cell13.InsertImageBefore(ConfigurationManager.AppSettings["strMediaLocation"] + "portfolio_tool\\line.gif");
                                                imgLine5.Width = 8600;
                                                imgLine5.Height = 20;
                                                Cell13.InsertTextAfter("----", fWhite);

                                                for (int m = 0; m < dtHobby.Rows.Count; m++)
                                                {
                                                    tblEtr[m + 2, 0].VertAlignment = TableCell.VerticalAlignment.Bottom;
                                                    tblEtr[m + 2, 0].InsertTextAfter(ch.ToString() + " ", fBullet);
                                                    tblEtr[m + 2, 0].InsertTextAfter(dtHobby.Rows[m]["MyActivity"].ToString(), fText);
                                                    if (dtHobby.Rows[m]["IntDescription"].ToString().Length > 0)
                                                        tblEtr[m + 2, 0].InsertTextAfter(" - " + dtHobby.Rows[m]["IntDescription"].ToString(), fText);
                                                }
                                                tblMain[tblMain.NumRows - 1, 0].InsertBreakAfter(Element.BreakType.TextWrap);
                                            }
                                        }
                                        else
                                        {
                                            if (dtHobby.Rows.Count > 0)
                                            {
                                                tblMain.AddRows(1);
                                                Table tblEtr = tblMain[tblMain.NumRows - 1, 0].InsertTableAfter(3, 1);
                                                TableCell Cell12 = tblEtr[0, 0];
                                                Cell12.VertAlignment = TableCell.VerticalAlignment.Top;
                                                tblEtr.set_RowHeight(0, 350);
                                                tblEtr.set_RowHeightExact(0, true);
                                                Cell12.InsertTextAfter(CCLib.Common.Strings.GeneratelanguageText(4037, strUserLanguage), fBold);

                                                TableCell Cell13 = tblEtr[1, 0];
                                                Cell13.VertAlignment = TableCell.VerticalAlignment.Top;
                                                InlineImage imgLine5 = Cell13.InsertImageBefore(ConfigurationManager.AppSettings["strMediaLocation"] + "portfolio_tool\\line.gif");
                                                imgLine5.Width = 8600;
                                                imgLine5.Height = 20;
                                                Cell13.InsertTextAfter("----", fWhite);

                                                string strExtra = "";
                                                for (int m = 0; m < dtHobby.Rows.Count; m++)
                                                {
                                                    strExtra = strExtra + dtHobby.Rows[m]["MyActivity"].ToString() + ", ";
                                                }
                                                if (strExtra.Length > 0)
                                                    strExtra = strExtra.Substring(0, strExtra.Length - 2);
                                                tblEtr[2, 0].InsertTextAfter(strExtra, fText);
                                                tblMain[tblMain.NumRows - 1, 0].InsertBreakAfter(Element.BreakType.TextWrap);
                                            }
                                        }
                                    }
                                }
                                break;
                            case "Skill":
                                if (drPortSettings["RBSkills" + intMenuGrade].ToString() == "True")
                                {
                                    if (dsSections.Tables["Skill"] != null)
                                    {
                                        dtSkill = dsSections.Tables["Skill"];
                                        if (dtPortfolio.Rows[0]["ResumeSections"].ToString().IndexOf("SkillsComments") > 0)
                                        {
                                            if (dtSkill.Rows.Count > 0)
                                            {
                                                tblMain.AddRows(1);
                                                Table tblSkill = tblMain[tblMain.NumRows - 1, 0].InsertTableAfter(dtSkill.Rows.Count + 2, 1);
                                                TableCell Cell14 = tblSkill[0, 0];
                                                Cell14.VertAlignment = TableCell.VerticalAlignment.Top;
                                                tblSkill.set_RowHeight(0, 350);
                                                tblSkill.set_RowHeightExact(0, true);
                                                Cell14.InsertTextAfter(CCLib.Common.Strings.GeneratelanguageText(2883, strUserLanguage), fBold);

                                                TableCell Cell15 = tblSkill[1, 0];
                                                Cell15.VertAlignment = TableCell.VerticalAlignment.Top;
                                                InlineImage imgLine6 = Cell15.InsertImageBefore(ConfigurationManager.AppSettings["strMediaLocation"] + "portfolio_tool\\line.gif");
                                                imgLine6.Width = 8600;
                                                imgLine6.Height = 20;
                                                Cell15.InsertTextAfter("----", fWhite);

                                                for (int m = 0; m < dtSkill.Rows.Count; m++)
                                                {
                                                    tblSkill[m + 2, 0].VertAlignment = TableCell.VerticalAlignment.Bottom;
                                                    tblSkill[m + 2, 0].InsertTextAfter(ch.ToString() + " ", fBullet);
                                                    tblSkill[m + 2, 0].InsertTextAfter(dtSkill.Rows[m]["Skill" + strUserLanguage].ToString(), fText);
                                                    if (dtSkill.Rows[m]["SkillDesc"].ToString().Length > 0)
                                                        tblSkill[m + 2, 0].InsertTextAfter(" - " + dtSkill.Rows[m]["SkillDesc"].ToString(), fText);
                                                }
                                                tblMain[tblMain.NumRows - 1, 0].InsertBreakAfter(Element.BreakType.TextWrap);
                                            }
                                        }
                                        else
                                        {
                                            if (dtSkill.Rows.Count > 0)
                                            {
                                                tblMain.AddRows(1);
                                                Table tblSkill = tblMain[tblMain.NumRows - 1, 0].InsertTableAfter(5, 1);
                                                TableCell Cell14 = tblSkill[0, 0];
                                                Cell14.VertAlignment = TableCell.VerticalAlignment.Top;
                                                tblSkill.set_RowHeight(0, 350);
                                                tblSkill.set_RowHeightExact(0, true);
                                                Cell14.InsertTextAfter(CCLib.Common.Strings.GeneratelanguageText(2883, strUserLanguage), fBold);

                                                TableCell Cell15 = tblSkill[1, 0];
                                                InlineImage imgLine6 = Cell15.InsertImageBefore(ConfigurationManager.AppSettings["strMediaLocation"] + "portfolio_tool\\line.gif");
                                                imgLine6.Width = 8600;
                                                imgLine6.Height = 20;
                                                Cell15.InsertTextAfter("----", fWhite);

                                                string strSkill2 = "";
                                                string strSkill1 = "";
                                                string strSkill3 = "";
                                                for (int m = 0; m < dtSkill.Rows.Count; m++)
                                                {
                                                    if (dtSkill.Rows[m]["SkillCategoryID"].ToString() == "2")
                                                        strSkill2 += dtSkill.Rows[m]["Skill" + strUserLanguage].ToString() + ", ";
                                                    if (dtSkill.Rows[m]["SkillCategoryID"].ToString() == "1")
                                                        strSkill1 += dtSkill.Rows[m]["Skill" + strUserLanguage].ToString() + ", ";
                                                    if (dtSkill.Rows[m]["SkillCategoryID"].ToString() == "3")
                                                        strSkill3 += dtSkill.Rows[m]["Skill" + strUserLanguage].ToString() + ", ";
                                                }
                                                if (strSkill2.Length > 0)
                                                {
                                                    strSkill2 = strSkill2.Substring(0, strSkill2.Length - 2);
                                                    tblSkill[2, 0].VertAlignment = TableCell.VerticalAlignment.Bottom;
                                                    tblSkill[2, 0].InsertTextAfter(ch.ToString() + " ", fBullet);
                                                    tblSkill[2, 0].InsertTextAfter(strSkill2, fText);
                                                }
                                                if (strSkill1.Length > 0)
                                                {
                                                    strSkill1 = strSkill1.Substring(0, strSkill1.Length - 2);
                                                    tblSkill[3, 0].VertAlignment = TableCell.VerticalAlignment.Bottom;
                                                    tblSkill[3, 0].InsertTextAfter(ch.ToString() + " ", fBullet);
                                                    tblSkill[3, 0].InsertTextAfter(strSkill1, fText);
                                                }
                                                if (strSkill3.Length > 0)
                                                {
                                                    strSkill3 = strSkill3.Substring(0, strSkill3.Length - 2);
                                                    tblSkill[4, 0].VertAlignment = TableCell.VerticalAlignment.Bottom;
                                                    tblSkill[4, 0].InsertTextAfter(ch.ToString() + " ", fBullet);
                                                    tblSkill[4, 0].InsertTextAfter(strSkill3, fText);
                                                }
                                                if (strSkill2.Length == 0)
                                                    tblSkill.DeleteRows(2, 0);
                                                if (strSkill1.Length == 0)
                                                    tblSkill.DeleteRows(3, 0);
                                                if (strSkill3.Length == 0)
                                                    tblSkill.DeleteRows(4, 0);
                                                tblMain[tblMain.NumRows - 1, 0].InsertBreakAfter(Element.BreakType.TextWrap);
                                            }
                                        }
                                    }
                                }
                                break;
                            case "Additional":
                                if (strAdditionalInfo == "True")
                                {
                                    if (dtPortfolio.Rows[0]["AddInfo"].ToString() != "")
                                    {
                                        tblMain.AddRows(1);
                                        Table tblAdd = tblMain[tblMain.NumRows - 1, 0].InsertTableAfter(3, 1);
                                        TableCell Cell17 = tblAdd[0, 0];
                                        Cell17.VertAlignment = TableCell.VerticalAlignment.Top;
                                        tblAdd.set_RowHeight(0, 350);
                                        tblAdd.set_RowHeightExact(0, true);
                                        Cell17.InsertTextAfter(CCLib.Common.Strings.GeneratelanguageText(2884, strUserLanguage), fBold);

                                        TableCell Cell18 = tblAdd[1, 0];
                                        Cell18.VertAlignment = TableCell.VerticalAlignment.Top;
                                        InlineImage imgLine7 = Cell18.InsertImageBefore(ConfigurationManager.AppSettings["strMediaLocation"] + "portfolio_tool\\line.gif");
                                        imgLine7.Width = 8600;
                                        imgLine7.Height = 20;
                                        Cell18.InsertTextAfter("----", fWhite);
                                        tblAdd[2, 0].InsertTextAfter(dtPortfolio.Rows[0]["AddInfo"].ToString().Trim(), fText);
                                        tblMain[tblMain.NumRows - 1, 0].InsertBreakAfter(Element.BreakType.TextWrap);
                                    }
                                }
                                break;
                            default: break;
                        }
                    }
                }

                string targetfile = ConfigurationManager.AppSettings["strResumeLocation"] + "word\\Resume_Word_" + strPortfolioID + "_Contemporary.doc";
                if (File.Exists(ConfigurationManager.AppSettings["strResumeLocation"] + "word\\Resume_Word_" + strPortfolioID + "_Contemporary.doc"))
                    File.Delete(ConfigurationManager.AppSettings["strResumeLocation"] + "word\\Resume_Word_" + strPortfolioID + "_Contemporary.doc");
                wordApp.Save(doc, targetfile);
                #endregion Build Resume

                #region Build Reference

                /* Initialize the WordApplication and create our document. */
                WordApplication wordAppRef = new WordApplication();
                Document docRef = wordAppRef.Create();

                //Create tblMain and tblContactInfo tables to keep consistent margin
                Table tblMainRef = docRef.InsertTableAfter(1, 1);
                Table tblContactInfoRef = tblMainRef[tblMainRef.NumRows - 1, 0].InsertTableAfter(2, 1);

                if (strPersonalInfo == "True")
                {
                    Font fInfo = docRef.CreateFont();
                    fInfo.FontName = "Garamond";
                    fInfo.FontSize = 9;
                    ParagraphFormatting pf = doc.CreateParagraphFormatting();
                    pf.TextJustification = ParagraphFormatting.Justification.Center;

                    // Add contact information to the document
                    if (dtPortfolio.Rows[0]["FirstName"].ToString().Trim() != "" && dtPortfolio.Rows[0]["LastName"].ToString().Trim() != "")
                    {
                        string sName = dtPortfolio.Rows[0]["FirstName"].ToString() + " " + dtPortfolio.Rows[0]["LastName"].ToString();
                        Font fName = docRef.CreateFont();
                        fName.FontName = "Garamond";
                        fName.FontSize = 18;
                        fName.Bold = true;
                        tblContactInfoRef[0, 0].ApplyParagraphFormatting(pf);
                        tblContactInfoRef[0, 0].VertAlignment = TableCell.VerticalAlignment.Top;
                        tblContactInfoRef.set_RowHeight(0, 450);
                        tblContactInfoRef.set_RowHeightExact(0, false);
                        tblContactInfoRef[0, 0].InsertTextAfter(sName, fName);
                    }

                    tblContactInfoRef[1, 0].ApplyParagraphFormatting(pf);
                    if (dtPortfolio.Rows[0]["Address1"].ToString().Trim() != "")
                    {
                        tblContactInfoRef[1, 0].InsertTextAfter(dtPortfolio.Rows[0]["Address1"].ToString(), fInfo);
                        if (dtPortfolio.Rows[0]["Address2"].ToString().Trim() != "")
                            tblContactInfoRef[1, 0].InsertTextAfter(", " + dtPortfolio.Rows[0]["Address2"].ToString(), fInfo);
                        tblContactInfoRef[1, 0].InsertBreakAfter(Element.BreakType.TextWrap);
                    }
                    if (dtPortfolio.Rows[0]["City"].ToString().Trim() != "")
                        tblContactInfoRef[1, 0].InsertTextAfter(dtPortfolio.Rows[0]["City"].ToString(), fInfo);
                    if (dtPortfolio.Rows[0]["StateProv"].ToString().Trim() != "")
                        tblContactInfoRef[1, 0].InsertTextAfter(", " + dtPortfolio.Rows[0]["StateProv"].ToString(), fInfo);
                    if (dtPortfolio.Rows[0]["PostalZip"].ToString().Trim() != "")
                        tblContactInfoRef[1, 0].InsertTextAfter(" " + dtPortfolio.Rows[0]["PostalZip"].ToString(), fInfo);
                    tblContactInfoRef[1, 0].InsertBreakAfter(Element.BreakType.TextWrap);
                    if (dtPortfolio.Rows[0]["Phone"].ToString().Trim() != "")
                    {
                        tblContactInfoRef[1, 0].InsertTextAfter(dtPortfolio.Rows[0]["Phone"].ToString(), fInfo);
                        tblContactInfoRef[1, 0].InsertBreakAfter(Element.BreakType.TextWrap);
                    }
                    if (dtPortfolio.Rows[0]["EmailAddress"].ToString().Trim() != "")
                    {
                        string strUrl = (dtPortfolio.Rows[0]["EmailAddress"].ToString());
                        tblContactInfoRef[1, 0].InsertTextAfter(dtPortfolio.Rows[0]["EmailAddress"].ToString(), fInfo);
                        tblContactInfoRef[1, 0].InsertBreakAfter(Element.BreakType.TextWrap);
                    }
                    if (dtPortfolio.Rows[0]["WebAddress"].ToString().Trim() != "")
                    {
                        string strUrl = (dtPortfolio.Rows[0]["WebAddress"].ToString().IndexOf("HTTP") == -1) ? "HTTP://" + dtPortfolio.Rows[0]["WebAddress"].ToString() : dtPortfolio.Rows[0]["WebAddress"].ToString();
                        tblContactInfoRef[1, 0].InsertTextAfter(dtPortfolio.Rows[0]["WebAddress"].ToString(), fInfo);
                    }
                    tblMainRef[0, 0].InsertBreakAfter(Element.BreakType.TextWrap);
                }

                dtRef = CCLib.Common.DataAccess.GetDataTable(" Select * from Port_Reference where Portfolioid=" + strPortfolioID);
                if (drPortSettings["RBReferences" + intMenuGrade].ToString() == "True")
                {
                    if (dtRef != null)
                    {
                        if (dtRef.Rows.Count > 0)
                        {
                            Font fBold = docRef.CreateFont();
                            fBold.FontName = "Garamond";
                            fBold.FontSize = 10;
                            fBold.Bold = true;
                            Font fText = doc.CreateFont();
                            fText.FontName = "Garamond";
                            fText.FontSize = 9;
                            Font fTextStrong = doc.CreateFont();
                            fTextStrong.FontName = "Garamond";
                            fTextStrong.FontSize = 9;
                            fTextStrong.Italic = true;
                            fTextStrong.Bold = true;
                            Font fBullet = docRef.CreateFont();
                            //fBullet.FontName = "Haettenschweiler";
                            fBullet.FontSize = 10;
                            fBullet.Bold = true;
                            Font fWhite = docRef.CreateFont();
                            fWhite.FontName = "Garamond";
                            fWhite.FontSize = 10;
                            fWhite.TextColor = System.Drawing.Color.White;

                            tblMainRef.AddRows(1);
                            Table tblRef = tblMainRef[tblMainRef.NumRows - 1, 0].InsertTableAfter(dtRef.Rows.Count + 2, 1);
                            TableCell Cell19 = tblRef[0, 0];
                            Cell19.VertAlignment = TableCell.VerticalAlignment.Top;
                            tblRef.set_RowHeight(0, 350);
                            tblRef.set_RowHeightExact(0, true);
                            Cell19.InsertTextAfter(CCLib.Common.Strings.GeneratelanguageText(2885, strUserLanguage), fBold);

                            TableCell Cell20 = tblRef[1, 0];
                            Cell20.VertAlignment = TableCell.VerticalAlignment.Top;
                            InlineImage imgLine8 = Cell20.InsertImageBefore(ConfigurationManager.AppSettings["strMediaLocation"] + "portfolio_tool\\line.gif");
                            imgLine8.Width = 8600;
                            imgLine8.Height = 20;
                            Cell20.InsertTextAfter("----", fWhite);

                            for (int m = 0; m < dtRef.Rows.Count; m++)
                            {
                                tblRef[m + 2, 0].InsertTextAfter(dtRef.Rows[m]["ReferenceName"].ToString(), fTextStrong);
                                tblRef[m + 2, 0].InsertBreakAfter(Element.BreakType.TextWrap);
                                tblRef[m + 2, 0].InsertTextAfter(dtRef.Rows[m]["Title"].ToString(), fText);
                                tblRef[m + 2, 0].InsertBreakAfter(Element.BreakType.TextWrap);
                                tblRef[m + 2, 0].InsertTextAfter(dtRef.Rows[m]["CompanySchool"].ToString(), fText);
                                if (dtRef.Rows[m]["Address1"].ToString() != "")
                                {
                                    tblRef[m + 2, 0].InsertBreakAfter(Element.BreakType.TextWrap);
                                    tblRef[m + 2, 0].InsertTextAfter(dtRef.Rows[m]["Address1"].ToString(), fText);
                                }
                                if (dtRef.Rows[m]["Address2"].ToString() != "")
                                {
                                    tblRef[m + 2, 0].InsertBreakAfter(Element.BreakType.TextWrap);
                                    tblRef[m + 2, 0].InsertTextAfter(dtRef.Rows[m]["Address2"].ToString(), fText);
                                }
                                if ((dtRef.Rows[m]["City"].ToString() != "") || (dtRef.Rows[m]["StateProv"].ToString() != ""))
                                {
                                    tblRef[m + 2, 0].InsertBreakAfter(Element.BreakType.TextWrap);
                                    tblRef[m + 2, 0].InsertTextAfter(dtRef.Rows[m]["City"].ToString() + ", " + dtRef.Rows[m]["StateProv"].ToString(), fText);
                                }
                                if (dtRef.Rows[m]["PostalZip"].ToString() != "")
                                {
                                    tblRef[m + 2, 0].InsertBreakAfter(Element.BreakType.TextWrap);
                                    tblRef[m + 2, 0].InsertTextAfter(dtRef.Rows[m]["PostalZip"].ToString(), fText);
                                }
                                if (dtRef.Rows[m]["Phone"].ToString() != "")
                                {
                                    tblRef[m + 2, 0].InsertBreakAfter(Element.BreakType.TextWrap);
                                    tblRef[m + 2, 0].InsertTextAfter(dtRef.Rows[m]["Phone"].ToString(), fText);
                                }
                                if (dtRef.Rows[m]["EmailAddress"].ToString() != "")
                                {
                                    tblRef[m + 2, 0].InsertBreakAfter(Element.BreakType.TextWrap);
                                    tblRef[m + 2, 0].InsertTextAfter(dtRef.Rows[m]["EmailAddress"].ToString(), fText);
                                }
                                if (m < dtRef.Rows.Count - 1)
                                    tblRef[m + 2, 0].InsertBreakAfter(Element.BreakType.TextWrap);
                            }
                            tblMainRef[tblMainRef.NumRows - 1, 0].InsertBreakAfter(Element.BreakType.TextWrap);
                        }
                    }
                }

                string targetfileRef = ConfigurationManager.AppSettings["strResumeLocation"] + "word\\ResumeRef_Word_" + strPortfolioID + "_Contemporary.doc";
                if (File.Exists(ConfigurationManager.AppSettings["strResumeLocation"] + "word\\ResumeRef_Word_" + strPortfolioID + "_Contemporary.doc"))
                    File.Delete(ConfigurationManager.AppSettings["strResumeLocation"] + "word\\ResumeRef_Word_" + strPortfolioID + "_Contemporary.doc");
                wordAppRef.Save(docRef, targetfileRef);
                #endregion Build Reference
            }
        }
Beispiel #2
0
        public static void GenerateProfessionalDocument(string strPortfolioID, bool blProfileTable, string strUserLanguage, string strPortTypeID, string strPortSettingTable)
        {
            DataTable dtPortfolio, dtEdu, dtWork, dtComm, dtAward, dtHobby, dtSkill, dtRef, dtOrg;
            string strPersonalInfo, strWorkExp, strCommunityHrs, strExtraOrg, strInterHobbies, strAdditionalInfo;//user info settings
            string[] arrResumeSections;
            int intMenuGrade;

            if (blProfileTable)
            {
                dtPortfolio = CCLib.Common.DataAccess.GetDataTable("select * from Port_ResumeBuilder_View where PortfolioID=" + strPortfolioID);
            }
            else
            {
                dtPortfolio = CCLib.Common.DataAccess.GetDataTable("select * from Portfolio where PortfolioID=" + strPortfolioID);

            }

            DataRow drPortSettings = CCLib.Login.GetPortSettings(strPortfolioID);

            arrResumeSections = CCLib.Common.Resume.GetSections(dtPortfolio, drPortSettings, blProfileTable);

            if (dtPortfolio.Rows.Count > 0)
            {
                switch (dtPortfolio.Rows[0]["GradeNumber"].ToString())
                {
                    case "1":
                        intMenuGrade = 5;
                        break;
                    case "2":
                        intMenuGrade = 5;
                        break;
                    case "3":
                        intMenuGrade = 5;
                        break;
                    case "4":
                        intMenuGrade = 5;
                        break;
                    case "5":
                        intMenuGrade = 5;
                        break;
                    case "6":
                        intMenuGrade = 6;
                        break;
                    case "7":
                        intMenuGrade = 7;
                        break;
                    case "8":
                        intMenuGrade = 8;
                        break;
                    case "9":
                        intMenuGrade = 9;
                        break;
                    case "10":
                        intMenuGrade = 10;
                        break;
                    case "11":
                        intMenuGrade = 11;
                        break;
                    case "12":
                        intMenuGrade = 12;
                        break;
                    case "13":
                        intMenuGrade = 13;
                        break;
                    case "30":
                        intMenuGrade = 13;
                        break;
                    case "40":
                        intMenuGrade = 13;
                        break;
                    case "50":
                        intMenuGrade = 13;
                        break;
                    case "60":
                        intMenuGrade = 13;
                        break;
                    case "70":
                        intMenuGrade = 13;
                        break;
                    default:
                        intMenuGrade = 6;
                        break;

                }
                if (blProfileTable)
                {
                    strPersonalInfo = drPortSettings["RBPersonalProfile" + intMenuGrade].ToString();
                    strWorkExp = drPortSettings["RBWorkExp" + intMenuGrade].ToString();
                    strCommunityHrs = drPortSettings["RBCommunity" + intMenuGrade].ToString();
                    strExtraOrg = drPortSettings["RBOrganizations" + intMenuGrade].ToString();
                    strInterHobbies = drPortSettings["RBHobbies" + intMenuGrade].ToString();
                    strAdditionalInfo = drPortSettings["RBAdditionalInfo" + intMenuGrade].ToString();
                }
                else
                {
                    strPersonalInfo = drPortSettings["PersonalProfile" + intMenuGrade].ToString();
                    strWorkExp = drPortSettings["RBWorkExp" + intMenuGrade].ToString();
                    strCommunityHrs = drPortSettings["RBCommunity" + intMenuGrade].ToString();
                    strExtraOrg = drPortSettings["RBOrganizations" + intMenuGrade].ToString();
                    strInterHobbies = drPortSettings["RBHobbies" + intMenuGrade].ToString();
                    strAdditionalInfo = drPortSettings["RBAdditionalInfo" + intMenuGrade].ToString();
                }

                byte c = 187; // for extended ASCII ">>"
                char ch = (char)c;

                /* Initialize the WordApplication and create our document. */
                WordApplication wordApp = new WordApplication();
                Document doc = wordApp.Create();

                //Create tblMain and tblContactInfo tables to keep consistent margin
                Table tblMain = doc.InsertTableAfter(2, 1);
                Table tblContactInfo = tblMain[0, 0].InsertTableAfter(1, 1);

                if (strPersonalInfo == "True")
                {
                    // Add contact information to the document
                    Paragraph pAddress = tblContactInfo[0, 0].InsertParagraphAfter(null);
                    pAddress.Formatting.TextJustification = ParagraphFormatting.Justification.Left;
                    Font fAddress = doc.CreateFont();
                    fAddress.FontName = "Arial";
                    fAddress.FontSize = 9;
                    if (dtPortfolio.Rows[0]["Address1"].ToString().Trim() != "")
                    {
                        pAddress.InsertTextAfter(dtPortfolio.Rows[0]["Address1"].ToString(), fAddress);
                        if (dtPortfolio.Rows[0]["Address2"].ToString().Trim() != "")
                            pAddress.InsertTextAfter(", " + dtPortfolio.Rows[0]["Address2"].ToString(), fAddress);
                    }
                    if (dtPortfolio.Rows[0]["City"].ToString().Trim() != "")
                    {
                        pAddress.InsertBreakAfter(Element.BreakType.TextWrap);
                        pAddress.InsertTextAfter(dtPortfolio.Rows[0]["City"].ToString(), fAddress);
                    }
                    if (dtPortfolio.Rows[0]["StateProv"].ToString().Trim() != "")
                        pAddress.InsertTextAfter(", " + dtPortfolio.Rows[0]["StateProv"].ToString(), fAddress);
                    if (dtPortfolio.Rows[0]["PostalZip"].ToString().Trim() != "")
                        pAddress.InsertTextAfter(" " + dtPortfolio.Rows[0]["PostalZip"].ToString(), fAddress);
                    if (dtPortfolio.Rows[0]["Phone"].ToString().Trim() != "")
                    {
                        pAddress.InsertBreakAfter(Element.BreakType.TextWrap);
                        pAddress.InsertTextAfter(dtPortfolio.Rows[0]["Phone"].ToString(), fAddress);
                    }
                    if (dtPortfolio.Rows[0]["EmailAddress"].ToString().Trim() != "")
                    {

                        string strUrl = (dtPortfolio.Rows[0]["EmailAddress"].ToString());
                        pAddress.InsertBreakAfter(Element.BreakType.TextWrap);
                        pAddress.InsertTextAfter(dtPortfolio.Rows[0]["EmailAddress"].ToString(), fAddress);
                    }
                    if (dtPortfolio.Rows[0]["WebAddress"].ToString().Trim() != "")
                    {
                        string strUrl = (dtPortfolio.Rows[0]["WebAddress"].ToString().IndexOf("HTTP") == -1) ? "HTTP://" + dtPortfolio.Rows[0]["WebAddress"].ToString() : dtPortfolio.Rows[0]["WebAddress"].ToString();
                        pAddress.InsertBreakAfter(Element.BreakType.TextWrap);
                        pAddress.InsertTextAfter(dtPortfolio.Rows[0]["WebAddress"].ToString(), fAddress);
                    }
                    if (dtPortfolio.Rows[0]["FirstName"].ToString().Trim() != "" && dtPortfolio.Rows[0]["LastName"].ToString().Trim() != "")
                    {
                        string sName = dtPortfolio.Rows[0]["FirstName"].ToString() + " " + dtPortfolio.Rows[0]["LastName"].ToString();
                        pAddress.InsertBreakAfter(Element.BreakType.TextWrap);
                        pAddress.InsertBreakAfter(Element.BreakType.TextWrap);
                        Font fName = doc.CreateFont();
                        fName.FontName = "Tahoma";
                        fName.FontSize = 24;
                        pAddress.InsertTextAfter(sName, fName);
                    }
                    InlineImage imgLine = tblContactInfo[0, 0].InsertImageAfter(ConfigurationManager.AppSettings["strMediaLocation"] + "portfolio_tool\\line.gif");
                    imgLine.Width = 8600;
                    imgLine.Height = 20;
                    //tblMain[0, 0].InsertBreakAfter(Element.BreakType.TextWrap);
                }

                if (arrResumeSections != null)
                {
                    DataSet dsSections = CCLib.Common.Resume.GetSectionsDetail(arrResumeSections, strPortfolioID, strPortTypeID, strUserLanguage);
                    Table tbl = tblMain[1, 0].InsertTableAfter(1, 2);

                    for (int i = 0; i < arrResumeSections.Length; i++)
                    {
                        Font fBold = doc.CreateFont();
                        fBold.FontName = "Tahoma";
                        fBold.FontSize = 10;
                        fBold.Bold = true;
                        Font fText = doc.CreateFont();
                        fText.FontName = "Arial";
                        fText.FontSize = 9;
                        Font fTextStrong = doc.CreateFont();
                        fTextStrong.FontName = "Arial";
                        fTextStrong.FontSize = 9;
                        fTextStrong.Italic = true;
                        fTextStrong.Bold = true;
                        Font fBullet = doc.CreateFont();
                        fBullet.FontName = "Haettenschweiler";
                        fBullet.FontSize = 10;
                        fBullet.Bold = true;

                        switch (arrResumeSections[i].ToString())
                        {
                            case "CareerObjective":
                                if (dtPortfolio.Rows[0]["CareerObjective"].ToString() != "")
                                {
                                    tbl.AddRows(1);
                                    TableCell Cell1 = tbl[tbl.NumRows - 1, 0];
                                    Cell1.CellWidthUnits = TableCell.WidthUnits.Percentage;
                                    Cell1.PreferredWidth = 25;
                                    TableCell Cell2 = tbl[tbl.NumRows - 1, 1];
                                    Cell2.CellWidthUnits = TableCell.WidthUnits.Percentage;
                                    Cell2.PreferredWidth = 75;
                                    Cell1.InsertTextAfter(CCLib.Common.Strings.GeneratelanguageText(2876, strUserLanguage), fBold);
                                    Table tblCO = Cell2.InsertTableAfter(1, 1);
                                    tblCO[0, 0].CellWidthUnits = TableCell.WidthUnits.Percentage;
                                    tblCO[0, 0].PreferredWidth = 100;
                                    tblCO[0, 0].InsertTextAfter(dtPortfolio.Rows[0]["CareerObjective"].ToString(), fText);
                                    Cell2.InsertBreakAfter(Element.BreakType.TextWrap);
                                }
                                break;
                            case "WorkExperience":
                                if (strWorkExp == "True")
                                {
                                    if (dsSections.Tables["WorkExperience"] != null)
                                    {
                                        dtWork = dsSections.Tables["WorkExperience"];
                                        if (dtWork.Rows.Count > 0)
                                        {
                                            tbl.AddRows(1);
                                            TableCell Cell3 = tbl[tbl.NumRows - 1, 0];
                                            TableCell Cell4 = tbl[tbl.NumRows - 1, 1];
                                            Cell3.InsertTextAfter(CCLib.Common.Strings.GeneratelanguageText(2878, strUserLanguage), fBold);
                                            Table tblDetail = Cell4.InsertTableAfter(dtWork.Rows.Count, 2);
                                            for (int j = 0; j < dtWork.Rows.Count; j++)
                                            {
                                                tblDetail[j, 0].CellWidthUnits = TableCell.WidthUnits.Percentage;
                                                tblDetail[j, 0].PreferredWidth = 30;
                                                if (dtWork.Rows[j]["StartMonthID"].ToString() != "0" && dtWork.Rows[j]["StartMonthID"].ToString() != "")
                                                    tblDetail[j, 0].InsertTextAfter(CCLib.Common.Strings.GetShortMonth(Convert.ToInt32(dtWork.Rows[j]["StartMonthID"]), strUserLanguage) + " " + dtWork.Rows[j]["StartYear"].ToString().Substring(2, 2) + " - ", fText);
                                                if (dtWork.Rows[j]["EndMonthID"].ToString() != "" && dtWork.Rows[j]["EndMonthID"].ToString() != "0")
                                                {
                                                    if (dtWork.Rows[j]["EndMonthID"].ToString().Trim() == "13")
                                                        tblDetail[j, 0].InsertTextAfter(CCLib.Common.Strings.GeneratelanguageText(2879, strUserLanguage), fText);
                                                    else
                                                        tblDetail[j, 0].InsertTextAfter(CCLib.Common.Strings.GetShortMonth(Convert.ToInt32(dtWork.Rows[j]["EndMonthID"]), strUserLanguage) + " " + dtWork.Rows[j]["EndYear"].ToString().Substring(2, 2), fText);
                                                }
                                                tblDetail[j, 1].CellWidthUnits = TableCell.WidthUnits.Percentage;
                                                tblDetail[j, 1].PreferredWidth = 70;
                                                tblDetail[j, 1].InsertTextAfter(dtWork.Rows[j]["Title"].ToString(), fText);
                                                tblDetail[j, 1].InsertBreakAfter(Element.BreakType.TextWrap);
                                                tblDetail[j, 1].InsertTextAfter(dtWork.Rows[j]["Company"].ToString(), fTextStrong);
                                                tblDetail[j, 1].InsertBreakAfter(Element.BreakType.TextWrap);
                                                tblDetail[j, 1].InsertTextAfter(dtWork.Rows[j]["City"].ToString(), fText);
                                                if ((dtWork.Rows[j]["City"].ToString() != "") && (dtWork.Rows[j]["StateProv"].ToString() != ""))
                                                { tblDetail[j, 1].InsertTextAfter(", ", fText); }
                                                tblDetail[j, 1].InsertTextAfter(dtWork.Rows[j]["StateProv"].ToString(), fText);
                                                if (dtWork.Rows[j]["ExpDesc"].ToString() != "")
                                                {
                                                    tblDetail[j, 1].InsertBreakAfter(Element.BreakType.TextWrap);
                                                    tblDetail[j, 1].InsertBreakAfter(Element.BreakType.TextWrap);
                                                    //tblDetail[j, 1].InsertTextAfter(ch.ToString() + " ", fBullet);
                                                    tblDetail[j, 1].InsertTextAfter("» " + dtWork.Rows[j]["ExpDesc"].ToString().Replace("\n", "\n» "), fText);
                                                }
                                                if (j < dtWork.Rows.Count - 1)
                                                    tblDetail[j, 1].InsertBreakAfter(Element.BreakType.TextWrap);
                                            }
                                            Cell4.InsertBreakAfter(Element.BreakType.TextWrap);
                                        }
                                    }
                                }
                                break;
                            case "Education":
                                if (drPortSettings["RBEducation" + intMenuGrade].ToString() == "True")
                                {
                                    if (dsSections.Tables["Education"] != null)
                                    {
                                        dtEdu = dsSections.Tables["Education"];
                                        if (dtEdu.Rows.Count > 0)
                                        {
                                            tbl.AddRows(1);
                                            TableCell Cell5 = tbl[tbl.NumRows - 1, 0];
                                            TableCell Cell6 = tbl[tbl.NumRows - 1, 1];
                                            Cell5.InsertTextAfter("Education", fBold);
                                            Table tblDetail = Cell6.InsertTableAfter(dtEdu.Rows.Count, 2);
                                            for (int j = 0; j < dtEdu.Rows.Count; j++)
                                            {
                                                tblDetail[j, 0].CellWidthUnits = TableCell.WidthUnits.Percentage;
                                                tblDetail[j, 0].PreferredWidth = 30;
                                                if (dtEdu.Rows[j]["StartMonthID"].ToString() != "0" && dtEdu.Rows[j]["StartMonthID"].ToString() != "")
                                                    tblDetail[j, 0].InsertTextAfter(CCLib.Common.Strings.GetShortMonth(Convert.ToInt32(dtEdu.Rows[j]["StartMonthID"]), strUserLanguage) + " " + dtEdu.Rows[j]["StartYear"].ToString().Substring(2, 2) + " - ", fText);
                                                if (dtEdu.Rows[j]["EndMonthID"].ToString() != "" && dtEdu.Rows[j]["EndMonthID"].ToString() != "0")
                                                {
                                                    if (dtEdu.Rows[j]["EndMonthID"].ToString().Trim() == "13")
                                                        tblDetail[j, 0].InsertTextAfter(CCLib.Common.Strings.GeneratelanguageText(2879, strUserLanguage), fText);
                                                    else
                                                        tblDetail[j, 0].InsertTextAfter(CCLib.Common.Strings.GetShortMonth(Convert.ToInt32(dtEdu.Rows[j]["EndMonthID"]), strUserLanguage) + " " + dtEdu.Rows[j]["EndYear"].ToString().Substring(2, 2), fText);
                                                }
                                                tblDetail[j, 1].CellWidthUnits = TableCell.WidthUnits.Percentage;
                                                tblDetail[j, 1].PreferredWidth = 70;
                                                tblDetail[j, 1].InsertTextAfter(dtEdu.Rows[j]["School"].ToString(), fText);
                                                tblDetail[j, 1].InsertBreakAfter(Element.BreakType.TextWrap);
                                                tblDetail[j, 1].InsertTextAfter(dtEdu.Rows[j]["Degree"].ToString(), fTextStrong);
                                                tblDetail[j, 1].InsertBreakAfter(Element.BreakType.TextWrap);
                                                tblDetail[j, 1].InsertTextAfter(dtEdu.Rows[j]["City"].ToString(), fText);
                                                if ((dtEdu.Rows[j]["City"].ToString() != "") && (dtEdu.Rows[j]["StateProv"].ToString() != ""))
                                                { tblDetail[j, 1].InsertTextAfter(", ", fText); }
                                                tblDetail[j, 1].InsertTextAfter(dtEdu.Rows[j]["StateProv"].ToString(), fText);
                                                if (dtEdu.Rows[j]["EduDesc"].ToString() != "")
                                                {
                                                    tblDetail[j, 1].InsertBreakAfter(Element.BreakType.TextWrap);
                                                    tblDetail[j, 1].InsertBreakAfter(Element.BreakType.TextWrap);
                                                    tblDetail[j, 1].InsertTextAfter(ch.ToString() + " ", fBullet);
                                                    tblDetail[j, 1].InsertTextAfter(dtEdu.Rows[j]["EduDesc"].ToString(), fText);
                                                }
                                                if (j < dtEdu.Rows.Count - 1)
                                                    tblDetail[j, 1].InsertBreakAfter(Element.BreakType.TextWrap);
                                            }
                                            Cell6.InsertBreakAfter(Element.BreakType.TextWrap);
                                        }
                                    }
                                }
                                break;
                            case "VolunteerExperience":
                                if (strCommunityHrs == "True")
                                {
                                    if (dsSections.Tables["VolunteerExperience"] != null)
                                    {
                                        dtComm = dsSections.Tables["VolunteerExperience"];
                                        if (dtComm.Rows.Count > 0)
                                        {
                                            tbl.AddRows(1);
                                            TableCell Cell7 = tbl[tbl.NumRows - 1, 0];
                                            TableCell Cell8 = tbl[tbl.NumRows - 1, 1];
                                            Cell7.InsertTextAfter(CCLib.Common.Strings.GenerateLanguageText(5369, strUserLanguage, false, strPortTypeID), fBold);
                                            Table tblDetail = Cell8.InsertTableAfter(dtComm.Rows.Count, 2);
                                            for (int j = 0; j < dtComm.Rows.Count; j++)
                                            {
                                                tblDetail[j, 0].CellWidthUnits = TableCell.WidthUnits.Percentage;
                                                tblDetail[j, 0].PreferredWidth = 30;
                                                if (dtComm.Rows[j]["StartMonthID"].ToString() != "0" && dtComm.Rows[j]["StartMonthID"].ToString() != "")
                                                    tblDetail[j, 0].InsertTextAfter(CCLib.Common.Strings.GetShortMonth(Convert.ToInt32(dtComm.Rows[j]["StartMonthID"]), strUserLanguage) + " " + dtComm.Rows[j]["StartYear"].ToString().Substring(2, 2) + " - ", fText);
                                                if (dtComm.Rows[j]["EndMonthID"].ToString() != "" && dtComm.Rows[j]["EndMonthID"].ToString() != "0")
                                                {
                                                    if (dtComm.Rows[j]["EndMonthID"].ToString().Trim() == "13")
                                                        tblDetail[j, 0].InsertTextAfter(CCLib.Common.Strings.GeneratelanguageText(2879, strUserLanguage), fText);
                                                    else
                                                        tblDetail[j, 0].InsertTextAfter(CCLib.Common.Strings.GetShortMonth(Convert.ToInt32(dtComm.Rows[j]["EndMonthID"]), strUserLanguage) + " " + dtComm.Rows[j]["EndYear"].ToString().Substring(2, 2), fText);
                                                }
                                                tblDetail[j, 1].CellWidthUnits = TableCell.WidthUnits.Percentage;
                                                tblDetail[j, 1].PreferredWidth = 70;
                                                tblDetail[j, 1].InsertTextAfter(dtComm.Rows[j]["Company"].ToString(), fText);
                                                tblDetail[j, 1].InsertBreakAfter(Element.BreakType.TextWrap);
                                                tblDetail[j, 1].InsertTextAfter(dtComm.Rows[j]["Title"].ToString(), fTextStrong);
                                                tblDetail[j, 1].InsertBreakAfter(Element.BreakType.TextWrap);
                                                tblDetail[j, 1].InsertTextAfter(dtComm.Rows[j]["City"].ToString(), fText);
                                                if ((dtComm.Rows[j]["City"].ToString() != "") && (dtComm.Rows[j]["StateProv"].ToString() != ""))
                                                { tblDetail[j, 1].InsertTextAfter(", ", fText); }
                                                tblDetail[j, 1].InsertTextAfter(dtComm.Rows[j]["StateProv"].ToString(), fText);
                                                if (dtComm.Rows[j]["ExpDesc"].ToString() != "")
                                                {
                                                    tblDetail[j, 1].InsertBreakAfter(Element.BreakType.TextWrap);
                                                    tblDetail[j, 1].InsertBreakAfter(Element.BreakType.TextWrap);
                                                    //tblDetail[j, 1].InsertTextAfter(ch.ToString() + " ", fBullet);
                                                    tblDetail[j, 1].InsertTextAfter("» " + dtComm.Rows[j]["ExpDesc"].ToString().Replace("\n", "\n» "), fText);
                                                }
                                                if (j < dtComm.Rows.Count - 1)
                                                    tblDetail[j, 1].InsertBreakAfter(Element.BreakType.TextWrap);
                                            }
                                            Cell8.InsertBreakAfter(Element.BreakType.TextWrap);
                                        }
                                    }
                                }
                                break;
                            case "Organization":
                                if (strExtraOrg == "True")
                                {
                                    if (dsSections.Tables["Organization"] != null)
                                    {
                                        dtOrg = dsSections.Tables["Organization"];
                                        if (dtPortfolio.Rows[0]["ResumeSections"].ToString().IndexOf("OrgComments") > 0)
                                        {
                                            if (dtOrg.Rows.Count > 0)
                                            {
                                                tbl.AddRows(1);
                                                TableCell Cell3 = tbl[tbl.NumRows - 1, 0];
                                                TableCell Cell4 = tbl[tbl.NumRows - 1, 1];
                                                Cell3.InsertTextAfter(CCLib.Common.Strings.GeneratelanguageText(5399, strUserLanguage), fBold);
                                                Table tblDetail = Cell4.InsertTableAfter(dtOrg.Rows.Count, 2);
                                                for (int j = 0; j < dtOrg.Rows.Count; j++)
                                                {
                                                    tblDetail[j, 0].CellWidthUnits = TableCell.WidthUnits.Percentage;
                                                    tblDetail[j, 0].PreferredWidth = 30;
                                                    if (dtOrg.Rows[j]["OrgStartMonth"].ToString() != "0" && dtOrg.Rows[j]["OrgStartMonth"].ToString() != "")
                                                        tblDetail[j, 0].InsertTextAfter(CCLib.Common.Strings.GetShortMonth(Convert.ToInt32(dtOrg.Rows[j]["OrgStartMonth"]), strUserLanguage) + " " + dtOrg.Rows[j]["OrgStartYear"].ToString().Substring(2, 2) + " - ", fText);
                                                    if (dtOrg.Rows[j]["OrgEndMonth"].ToString() != "" && dtOrg.Rows[j]["OrgEndMonth"].ToString() != "0")
                                                    {
                                                        if (dtOrg.Rows[j]["OrgEndMonth"].ToString().Trim() == "13")
                                                            tblDetail[j, 0].InsertTextAfter(CCLib.Common.Strings.GeneratelanguageText(2879, strUserLanguage), fText);
                                                        else
                                                            tblDetail[j, 0].InsertTextAfter(CCLib.Common.Strings.GetShortMonth(Convert.ToInt32(dtOrg.Rows[j]["OrgEndMonth"]), strUserLanguage) + " " + dtOrg.Rows[j]["OrgEndYear"].ToString().Substring(2, 2), fText);
                                                    }
                                                    tblDetail[j, 1].CellWidthUnits = TableCell.WidthUnits.Percentage;
                                                    tblDetail[j, 1].PreferredWidth = 70;
                                                    tblDetail[j, 1].InsertTextAfter(dtOrg.Rows[j]["MyActivity"].ToString(), fTextStrong);
                                                    tblDetail[j, 1].InsertBreakAfter(Element.BreakType.TextWrap);
                                                    if (dtOrg.Rows[j]["OrgDescription"].ToString() != "")
                                                    {
                                                        tblDetail[j, 1].InsertTextAfter(ch.ToString() + " ", fBullet);
                                                        tblDetail[j, 1].InsertTextAfter(dtOrg.Rows[j]["OrgDescription"].ToString(), fText);
                                                    }
                                                    if (j < dtOrg.Rows.Count - 1)
                                                        tblDetail[j, 1].InsertBreakAfter(Element.BreakType.TextWrap);
                                                }
                                                Cell4.InsertBreakAfter(Element.BreakType.TextWrap);
                                            }
                                        }
                                        else
                                        {
                                            if (dtOrg.Rows.Count > 0)
                                            {
                                                tbl.AddRows(1);
                                                TableCell Cell11 = tbl[tbl.NumRows - 1, 0];
                                                TableCell Cell12 = tbl[tbl.NumRows - 1, 1];
                                                Cell11.InsertTextAfter(CCLib.Common.Strings.GeneratelanguageText(5399, strUserLanguage), fBold);
                                                string strOrg = "";
                                                for (int m = 0; m < dtOrg.Rows.Count; m++)
                                                {
                                                    strOrg = strOrg + dtOrg.Rows[m]["MyActivity"].ToString() + ", ";
                                                }
                                                if (strOrg.Length > 0)
                                                    strOrg = strOrg.Substring(0, strOrg.Length - 2);
                                                Table tblOrg = Cell12.InsertTableAfter(1, 1);
                                                tblOrg[0, 0].CellWidthUnits = TableCell.WidthUnits.Percentage;
                                                tblOrg[0, 0].PreferredWidth = 100;
                                                tblOrg[0, 0].InsertTextAfter(strOrg, fText);
                                                Cell12.InsertBreakAfter(Element.BreakType.TextWrap);
                                            }
                                        }
                                    }
                                }
                                break;
                            case "Award":
                                if (drPortSettings["RBAwards" + intMenuGrade].ToString() == "True")
                                {
                                    if (dsSections.Tables["Award"] != null)
                                    {
                                        dtAward = dsSections.Tables["Award"];
                                        if (dtAward.Rows.Count > 0)
                                        {
                                            tbl.AddRows(1);
                                            TableCell Cell9 = tbl[tbl.NumRows - 1, 0];
                                            TableCell Cell10 = tbl[tbl.NumRows - 1, 1];
                                            Cell9.InsertTextAfter(CCLib.Common.Strings.GeneratelanguageText(5398, strUserLanguage), fBold);
                                            Table tblDetail = Cell10.InsertTableAfter(dtAward.Rows.Count, 2);
                                            for (int m = 0; m < dtAward.Rows.Count; m++)
                                            {
                                                DateTime d = (DateTime)dtAward.Rows[m]["AwardDate"];
                                                string y = d.Year.ToString().Substring(2, 2);
                                                string mm = CCLib.Common.Strings.GetShortMonth(d.Month, strUserLanguage);
                                                tblDetail[m, 0].CellWidthUnits = TableCell.WidthUnits.Percentage;
                                                tblDetail[m, 0].PreferredWidth = 5;
                                                tblDetail[m, 0].VertAlignment = TableCell.VerticalAlignment.Top;
                                                tblDetail[m, 1].CellWidthUnits = TableCell.WidthUnits.Percentage;
                                                tblDetail[m, 1].PreferredWidth = 95;
                                                tblDetail[m, 1].VertAlignment = TableCell.VerticalAlignment.Bottom;
                                                //tblDetail[m, 0].InsertTextAfter("", fText);
                                                tblDetail[m, 0].InsertTextAfter(ch.ToString(), fBullet);
                                                tblDetail[m, 1].InsertTextAfter(dtAward.Rows[m]["AwardName"].ToString() + " (" + mm + " " + y + ")", fText);
                                            }
                                            Cell10.InsertBreakAfter(Element.BreakType.TextWrap);
                                        }
                                    }
                                }
                                break;
                            case "Extracurricular":
                                if (strInterHobbies == "True")
                                {
                                    if (dsSections.Tables["Extracurricular"] != null)
                                    {
                                        dtHobby = dsSections.Tables["Extracurricular"];
                                        if (dtPortfolio.Rows[0]["ResumeSections"].ToString().IndexOf("ExtraComments") > 0)
                                        {
                                            if (dtHobby.Rows.Count > 0)
                                            {
                                                tbl.AddRows(1);
                                                TableCell Cell11 = tbl[tbl.NumRows - 1, 0];
                                                TableCell Cell12 = tbl[tbl.NumRows - 1, 1];
                                                Cell11.InsertTextAfter(CCLib.Common.Strings.GeneratelanguageText(4037, strUserLanguage), fBold);
                                                Table tblDetail = Cell12.InsertTableAfter(dtHobby.Rows.Count, 2);
                                                for (int m = 0; m < dtHobby.Rows.Count; m++)
                                                {
                                                    tblDetail[m, 0].CellWidthUnits = TableCell.WidthUnits.Percentage;
                                                    tblDetail[m, 0].PreferredWidth = 5;
                                                    tblDetail[m, 0].VertAlignment = TableCell.VerticalAlignment.Top;
                                                    tblDetail[m, 1].CellWidthUnits = TableCell.WidthUnits.Percentage;
                                                    tblDetail[m, 1].PreferredWidth = 95;
                                                    tblDetail[m, 1].VertAlignment = TableCell.VerticalAlignment.Bottom;
                                                    tblDetail[m, 0].InsertTextAfter(ch.ToString(), fBullet);
                                                    tblDetail[m, 1].InsertTextAfter(dtHobby.Rows[m]["MyActivity"].ToString(), fText);
                                                    if (dtHobby.Rows[m]["IntDescription"].ToString().Length > 0)
                                                        tblDetail[m, 1].InsertTextAfter(" - " + dtHobby.Rows[m]["IntDescription"].ToString(), fText);
                                                }
                                                Cell12.InsertBreakAfter(Element.BreakType.TextWrap);
                                            }
                                        }
                                        else
                                        {
                                            if (dtHobby.Rows.Count > 0)
                                            {
                                                tbl.AddRows(1);
                                                TableCell Cell11 = tbl[tbl.NumRows - 1, 0];
                                                TableCell Cell12 = tbl[tbl.NumRows - 1, 1];
                                                Cell11.InsertTextAfter(CCLib.Common.Strings.GeneratelanguageText(4037, strUserLanguage), fBold);
                                                string strExtra = "";
                                                for (int m = 0; m < dtHobby.Rows.Count; m++)
                                                {
                                                    strExtra = strExtra + dtHobby.Rows[m]["MyActivity"].ToString() + ", ";
                                                }
                                                if (strExtra.Length > 0)
                                                    strExtra = strExtra.Substring(0, strExtra.Length - 2);
                                                Table tblExtra = Cell12.InsertTableAfter(1, 1);
                                                tblExtra[0, 0].CellWidthUnits = TableCell.WidthUnits.Percentage;
                                                tblExtra[0, 0].PreferredWidth = 100;
                                                tblExtra[0, 0].InsertTextAfter(strExtra, fText);
                                                Cell12.InsertBreakAfter(Element.BreakType.TextWrap);
                                            }
                                        }
                                    }
                                }
                                break;
                            case "Skill":
                                if (drPortSettings["RBSkills" + intMenuGrade].ToString() == "True")
                                {
                                    if (dsSections.Tables["Skill"] != null)
                                    {
                                        dtSkill = dsSections.Tables["Skill"];
                                        if (dtPortfolio.Rows[0]["ResumeSections"].ToString().IndexOf("SkillsComments") > 0)
                                        {
                                            if (dtSkill.Rows.Count > 0)
                                            {
                                                tbl.AddRows(1);
                                                TableCell Cell13 = tbl[tbl.NumRows - 1, 0];
                                                TableCell Cell14 = tbl[tbl.NumRows - 1, 1];
                                                Cell13.InsertTextAfter(CCLib.Common.Strings.GeneratelanguageText(2883, strUserLanguage), fBold);
                                                Table tblDetail = Cell14.InsertTableAfter(dtSkill.Rows.Count, 2);
                                                for (int m = 0; m < dtSkill.Rows.Count; m++)
                                                {
                                                    tblDetail[m, 0].CellWidthUnits = TableCell.WidthUnits.Percentage;
                                                    tblDetail[m, 0].PreferredWidth = 5;
                                                    tblDetail[m, 0].VertAlignment = TableCell.VerticalAlignment.Top;
                                                    tblDetail[m, 1].CellWidthUnits = TableCell.WidthUnits.Percentage;
                                                    tblDetail[m, 1].PreferredWidth = 95;
                                                    tblDetail[m, 1].VertAlignment = TableCell.VerticalAlignment.Bottom;
                                                    tblDetail[m, 0].InsertTextAfter(ch.ToString(), fBullet);
                                                    tblDetail[m, 1].InsertTextAfter(dtSkill.Rows[m]["Skill" + strUserLanguage].ToString(), fText);
                                                    if (dtSkill.Rows[m]["SkillDesc"].ToString().Length > 0)
                                                        tblDetail[m, 1].InsertTextAfter(" - " + dtSkill.Rows[m]["SkillDesc"].ToString(), fText);
                                                }
                                                Cell14.InsertBreakAfter(Element.BreakType.TextWrap);
                                            }
                                        }
                                        else
                                        {
                                            if (dtSkill.Rows.Count > 0)
                                            {
                                                tbl.AddRows(1);
                                                TableCell Cell13 = tbl[tbl.NumRows - 1, 0];
                                                TableCell Cell14 = tbl[tbl.NumRows - 1, 1];
                                                Cell13.InsertTextAfter(CCLib.Common.Strings.GeneratelanguageText(2883, strUserLanguage), fBold);
                                                string strSkill2 = "";
                                                string strSkill1 = "";
                                                string strSkill3 = "";
                                                for (int m = 0; m < dtSkill.Rows.Count; m++)
                                                {
                                                    if (dtSkill.Rows[m]["SkillCategoryID"].ToString() == "2")
                                                        strSkill2 += dtSkill.Rows[m]["Skill" + strUserLanguage].ToString() + ", ";
                                                    if (dtSkill.Rows[m]["SkillCategoryID"].ToString() == "1")
                                                        strSkill1 += dtSkill.Rows[m]["Skill" + strUserLanguage].ToString() + ", ";
                                                    if (dtSkill.Rows[m]["SkillCategoryID"].ToString() == "3")
                                                        strSkill3 += dtSkill.Rows[m]["Skill" + strUserLanguage].ToString() + ", ";
                                                }
                                                Table tblSkill = Cell14.InsertTableAfter(1, 2);
                                                if (strSkill2.Length > 0)
                                                {
                                                    strSkill2 = strSkill2.Substring(0, strSkill2.Length - 2);
                                                    tblSkill.AddRows(1);
                                                    TableCell cSkill1 = tblSkill[tblSkill.NumRows - 1, 0];
                                                    TableCell cSkill2 = tblSkill[tblSkill.NumRows - 1, 1];
                                                    cSkill1.CellWidthUnits = TableCell.WidthUnits.Percentage;
                                                    cSkill1.PreferredWidth = 5;
                                                    cSkill1.VertAlignment = TableCell.VerticalAlignment.Top;
                                                    cSkill2.CellWidthUnits = TableCell.WidthUnits.Percentage;
                                                    cSkill2.PreferredWidth = 95;
                                                    cSkill2.VertAlignment = TableCell.VerticalAlignment.Bottom;
                                                    cSkill1.InsertTextAfter(ch.ToString(), fBullet);
                                                    cSkill2.InsertTextAfter(strSkill2, fText);
                                                }
                                                if (strSkill1.Length > 0)
                                                {
                                                    strSkill1 = strSkill1.Substring(0, strSkill1.Length - 2);
                                                    tblSkill.AddRows(1);
                                                    TableCell cSkill3 = tblSkill[tblSkill.NumRows - 1, 0];
                                                    TableCell cSkill4 = tblSkill[tblSkill.NumRows - 1, 1];
                                                    cSkill3.CellWidthUnits = TableCell.WidthUnits.Percentage;
                                                    cSkill3.PreferredWidth = 5;
                                                    cSkill3.VertAlignment = TableCell.VerticalAlignment.Top;
                                                    cSkill4.CellWidthUnits = TableCell.WidthUnits.Percentage;
                                                    cSkill4.PreferredWidth = 95;
                                                    cSkill4.VertAlignment = TableCell.VerticalAlignment.Bottom;
                                                    cSkill3.InsertTextAfter(ch.ToString(), fBullet);
                                                    cSkill4.InsertTextAfter(strSkill1, fText);
                                                }
                                                if (strSkill3.Length > 0)
                                                {
                                                    strSkill3 = strSkill3.Substring(0, strSkill3.Length - 2);
                                                    tblSkill.AddRows(1);
                                                    TableCell cSkill5 = tblSkill[tblSkill.NumRows - 1, 0];
                                                    TableCell cSkill6 = tblSkill[tblSkill.NumRows - 1, 1];
                                                    cSkill5.CellWidthUnits = TableCell.WidthUnits.Percentage;
                                                    cSkill5.PreferredWidth = 5;
                                                    cSkill5.VertAlignment = TableCell.VerticalAlignment.Top;
                                                    cSkill6.CellWidthUnits = TableCell.WidthUnits.Percentage;
                                                    cSkill6.PreferredWidth = 95;
                                                    cSkill6.VertAlignment = TableCell.VerticalAlignment.Bottom;
                                                    cSkill5.InsertTextAfter(ch.ToString(), fBullet);
                                                    cSkill6.InsertTextAfter(strSkill3, fText);
                                                }
                                                //tblSkill.DeleteRows(0, 0);
                                                Cell14.InsertBreakAfter(Element.BreakType.TextWrap);
                                            }
                                        }
                                    }
                                }
                                break;
                            case "Additional":
                                if (strAdditionalInfo == "True")
                                {
                                    if (dtPortfolio.Rows[0]["AddInfo"].ToString() != "")
                                    {
                                        tbl.AddRows(1);
                                        TableCell Cell15 = tbl[tbl.NumRows - 1, 0];
                                        TableCell Cell16 = tbl[tbl.NumRows - 1, 1];
                                        Cell15.InsertTextAfter(CCLib.Common.Strings.GeneratelanguageText(2884, strUserLanguage), fBold);
                                        Table tblAdd = Cell16.InsertTableAfter(1, 1);
                                        tblAdd[0, 0].CellWidthUnits = TableCell.WidthUnits.Percentage;
                                        tblAdd[0, 0].PreferredWidth = 100;
                                        tblAdd[0, 0].InsertTextAfter(dtPortfolio.Rows[0]["AddInfo"].ToString().Trim(), fText);
                                        Cell16.InsertBreakAfter(Element.BreakType.TextWrap);
                                    }
                                }
                                break;
                            case "Reference":
                                if (drPortSettings["RBReferences" + intMenuGrade].ToString() == "True")
                                {
                                    if (dsSections.Tables["Reference"] != null)
                                    {
                                        dtRef = dsSections.Tables["Reference"];
                                        if (dtPortfolio.Rows[0]["ResumeReference"].ToString().ToUpper() == "YES")
                                        {
                                            if (dtRef.Rows.Count > 0)
                                            {
                                                tbl.AddRows(1);
                                                TableCell Cell17 = tbl[tbl.NumRows - 1, 0];
                                                TableCell Cell18 = tbl[tbl.NumRows - 1, 1];
                                                Cell17.InsertTextAfter(CCLib.Common.Strings.GeneratelanguageText(2885, strUserLanguage), fBold);
                                                Table tblRef = Cell18.InsertTableAfter(dtRef.Rows.Count, 1);
                                                for (int m = 0; m < dtRef.Rows.Count; m++)
                                                {
                                                    tblRef[m, 0].CellWidthUnits = TableCell.WidthUnits.Percentage;
                                                    tblRef[m, 0].PreferredWidth = 100;
                                                    tblRef[m, 0].InsertTextAfter(dtRef.Rows[m]["ReferenceName"].ToString(), fTextStrong);
                                                    tblRef[m, 0].InsertBreakAfter(Element.BreakType.TextWrap);
                                                    tblRef[m, 0].InsertTextAfter(dtRef.Rows[m]["Title"].ToString(), fText);
                                                    tblRef[m, 0].InsertBreakAfter(Element.BreakType.TextWrap);
                                                    tblRef[m, 0].InsertTextAfter(dtRef.Rows[m]["CompanySchool"].ToString(), fText);
                                                    if (dtRef.Rows[m]["Address1"].ToString() != "")
                                                    {
                                                        tblRef[m, 0].InsertBreakAfter(Element.BreakType.TextWrap);
                                                        tblRef[m, 0].InsertTextAfter(dtRef.Rows[m]["Address1"].ToString(), fText);
                                                    }
                                                    if (dtRef.Rows[m]["Address2"].ToString() != "")
                                                    {
                                                        tblRef[m, 0].InsertBreakAfter(Element.BreakType.TextWrap);
                                                        tblRef[m, 0].InsertTextAfter(dtRef.Rows[m]["Address2"].ToString(), fText);
                                                    }
                                                    if ((dtRef.Rows[m]["City"].ToString() != "") || (dtRef.Rows[m]["StateProv"].ToString() != ""))
                                                    {
                                                        tblRef[m, 0].InsertBreakAfter(Element.BreakType.TextWrap);
                                                        tblRef[m, 0].InsertTextAfter(dtRef.Rows[m]["City"].ToString() + "," + dtRef.Rows[m]["StateProv"].ToString(), fText);
                                                    }
                                                    if (dtRef.Rows[m]["PostalZip"].ToString() != "")
                                                    {
                                                        tblRef[m, 0].InsertBreakAfter(Element.BreakType.TextWrap);
                                                        tblRef[m, 0].InsertTextAfter(dtRef.Rows[m]["PostalZip"].ToString(), fText);
                                                    }
                                                    if (dtRef.Rows[m]["Phone"].ToString() != "")
                                                    {
                                                        tblRef[m, 0].InsertBreakAfter(Element.BreakType.TextWrap);
                                                        tblRef[m, 0].InsertTextAfter(dtRef.Rows[m]["Phone"].ToString(), fText);
                                                    }
                                                    if (dtRef.Rows[m]["EmailAddress"].ToString() != "")
                                                    {
                                                        tblRef[m, 0].InsertBreakAfter(Element.BreakType.TextWrap);
                                                        tblRef[m, 0].InsertTextAfter(dtRef.Rows[m]["EmailAddress"].ToString(), fText);
                                                    }
                                                    if (m < dtRef.Rows.Count - 1)
                                                        tblRef[m, 0].InsertBreakAfter(Element.BreakType.TextWrap);
                                                }
                                                Cell18.InsertBreakAfter(Element.BreakType.TextWrap);
                                            }
                                        }
                                        else
                                        {
                                            tbl.AddRows(1);
                                            TableCell Cell17 = tbl[tbl.NumRows - 1, 0];
                                            TableCell Cell18 = tbl[tbl.NumRows - 1, 1];
                                            Cell17.InsertTextAfter(CCLib.Common.Strings.GeneratelanguageText(2885, strUserLanguage), fBold);
                                            Table tblRef = Cell18.InsertTableAfter(1, 1);
                                            tblRef[0, 0].CellWidthUnits = TableCell.WidthUnits.Percentage;
                                            tblRef[0, 0].PreferredWidth = 100;
                                            tblRef[0, 0].InsertTextAfter(CCLib.Common.Strings.GeneratelanguageText(2886, strUserLanguage), fText);
                                            Cell18.InsertBreakAfter(Element.BreakType.TextWrap);
                                        }
                                    }
                                }
                                break;
                            default: break;
                        }
                    }
                    //tbl.DeleteRows(0, 0);

                }

                string targetfile = ConfigurationManager.AppSettings["strResumeLocation"] + "word\\Resume_Word_" + strPortfolioID + "_Professional.doc";
                if (File.Exists(ConfigurationManager.AppSettings["strResumeLocation"] + "word\\Resume_Word_" + strPortfolioID + "_Professional.doc"))
                    File.Delete(ConfigurationManager.AppSettings["strResumeLocation"] + "word\\Resume_Word_" + strPortfolioID + "_Professional.doc");
                wordApp.Save(doc, targetfile);

            }
        }