public static TableCell CreateColumnHeader(ColumnTable column) { TableCell tableCell1 = new TableCell(); TableCellProperties tableCellProperties1 = new TableCellProperties(); ConditionalFormatStyle conditionalFormatStyle2 = new ConditionalFormatStyle() { Val = "001000000000", FirstRow = false, LastRow = false, FirstColumn = true, LastColumn = false, OddVerticalBand = false, EvenVerticalBand = false, OddHorizontalBand = false, EvenHorizontalBand = false, FirstRowFirstColumn = false, FirstRowLastColumn = false, LastRowFirstColumn = false, LastRowLastColumn = false }; TableCellWidth tableCellWidth1 = new TableCellWidth() { Type = TableWidthUnitValues.Dxa }; tableCellProperties1.Append(conditionalFormatStyle2); tableCellProperties1.Append(tableCellWidth1); Paragraph paragraph1 = new Paragraph() { RsidParagraphMarkRevision = "00451032", RsidParagraphAddition = "00D149A8", RsidParagraphProperties = "00AD5D8A", RsidRunAdditionDefault = "00D149A8" }; ParagraphProperties paragraphProperties1 = new ParagraphProperties(); ParagraphMarkRunProperties paragraphMarkRunProperties1 = new ParagraphMarkRunProperties(); RunFonts runFonts1 = new RunFonts() { Ascii = "Times New Roman", HighAnsi = "Times New Roman", ComplexScript = "Times New Roman" }; FontSize fontSize1 = new FontSize() { Val = "28" }; FontSizeComplexScript fontSizeComplexScript1 = new FontSizeComplexScript() { Val = "28" }; paragraphMarkRunProperties1.Append(runFonts1); paragraphMarkRunProperties1.Append(fontSize1); paragraphMarkRunProperties1.Append(fontSizeComplexScript1); paragraphProperties1.Append(paragraphMarkRunProperties1); Run run1 = new Run(); RunProperties runProperties2 = new RunProperties(); RunFonts runFonts2 = new RunFonts() { Ascii = "Times New Roman", HighAnsi = "Times New Roman", ComplexScript = "Times New Roman" }; FontSize fontSize2 = new FontSize() { Val = "28" }; FontSizeComplexScript fontSizeComplexScript2 = new FontSizeComplexScript() { Val = "28" }; runProperties2.Append(runFonts2); runProperties2.Append(fontSize2); runProperties2.Append(fontSizeComplexScript2); Text text1 = new Text(); text1.Text = column.ColumnHeader; run1.Append(runProperties2); run1.Append(text1); paragraph1.Append(paragraphProperties1); paragraph1.Append(run1); tableCell1.Append(tableCellProperties1); tableCell1.Append(paragraph1); return(tableCell1); }
public static TableCell CreateColumnCell(ColumnTable column) { TableCell tableCell = new TableCell(); TableCellProperties tableCellProperties = new TableCellProperties(); DocumentFormat.OpenXml.Wordprocessing.ConditionalFormatStyle conditionalFormatStyleCell1 = new ConditionalFormatStyle() { Val = "001000000000", FirstRow = false, LastRow = false, FirstColumn = true, LastColumn = false, OddVerticalBand = false, EvenVerticalBand = false, OddHorizontalBand = false, EvenHorizontalBand = false, FirstRowFirstColumn = false, FirstRowLastColumn = false, LastRowFirstColumn = false, LastRowLastColumn = false }; DocumentFormat.OpenXml.Wordprocessing.TableCellWidth tableCellWidth1 = new TableCellWidth() { Type = TableWidthUnitValues.Dxa }; tableCellProperties.Append(conditionalFormatStyleCell1); tableCellProperties.Append(tableCellWidth1); SdtBlock sdtBlockSub = new SdtBlock(); SdtProperties sdtProperties = new SdtProperties(); RunProperties runProperties = new RunProperties(); RunFonts runFonts1 = new RunFonts() { Ascii = "Times New Roman", HighAnsi = "Times New Roman", ComplexScript = "Times New Roman" }; FontSize fontSize1 = new FontSize() { Val = "28" }; FontSizeComplexScript fontSizeComplexScript1 = new FontSizeComplexScript() { Val = "28" }; runProperties.Append(runFonts1); runProperties.Append(fontSize1); runProperties.Append(fontSizeComplexScript1); SdtAlias sdtAliasSub = new SdtAlias() { Val = column.ColumnField }; Tag tagCell = new Tag() { Val = column.ColumnField }; SdtId sdtIdCell = new SdtId() { Val = -2144724967 }; SdtPlaceholder sdtPlaceholderCell1 = new SdtPlaceholder(); DocPartReference docPartReferenceCell1 = new DocPartReference() { Val = "941489452D594FF2A513A53EEFA3E58F" }; sdtPlaceholderCell1.Append(docPartReferenceCell1); sdtProperties.Append(runProperties); sdtProperties.Append(sdtAliasSub); sdtProperties.Append(tagCell); sdtProperties.Append(sdtIdCell); sdtProperties.Append(sdtPlaceholderCell1); SdtContentBlock sdtContentBlockSub = new SdtContentBlock(); Paragraph paragraphCell = new Paragraph() { RsidParagraphAddition = "00C03259", RsidParagraphProperties = "00BB7EFE", RsidRunAdditionDefault = "00C03259" }; ParagraphProperties paragraphProperties1 = new ParagraphProperties(); ParagraphMarkRunProperties paragraphMarkRunPropertiesCell = new ParagraphMarkRunProperties(); RunFonts runFonts2 = new RunFonts() { Ascii = "Times New Roman", HighAnsi = "Times New Roman", ComplexScript = "Times New Roman" }; FontSize fontSize2 = new FontSize() { Val = "28" }; FontSizeComplexScript fontSizeComplexScript2 = new FontSizeComplexScript() { Val = "28" }; paragraphMarkRunPropertiesCell.Append(runFonts2); paragraphMarkRunPropertiesCell.Append(fontSize2); paragraphMarkRunPropertiesCell.Append(fontSizeComplexScript2); paragraphProperties1.Append(paragraphMarkRunPropertiesCell); Run runCell = new Run(); RunProperties runPropertiesCell = new RunProperties(); RunFonts runFonts3 = new RunFonts() { Ascii = "Times New Roman", HighAnsi = "Times New Roman", ComplexScript = "Times New Roman" }; Bold bold1 = new Bold() { Val = false }; FontSize fontSize3 = new FontSize() { Val = "28" }; FontSizeComplexScript fontSizeComplexScript3 = new FontSizeComplexScript() { Val = "28" }; runPropertiesCell.Append(runFonts3); runPropertiesCell.Append(bold1); runPropertiesCell.Append(fontSize3); runPropertiesCell.Append(fontSizeComplexScript3); Text textCell = new Text(); textCell.Text = column.ColumnHeader; runCell.Append(runPropertiesCell); runCell.Append(textCell); paragraphCell.Append(paragraphProperties1); paragraphCell.Append(runCell); sdtContentBlockSub.Append(paragraphCell); sdtBlockSub.Append(sdtProperties); sdtBlockSub.Append(sdtContentBlockSub); tableCell.Append(tableCellProperties); tableCell.Append(sdtBlockSub); return(tableCell); }