//..................................................................... /// <summary> /// /// </summary> /// <param name="listing"></param> public void MakeTableRow(List <string> listing, double height) { int cellwidt = ( int )(OPENXML_A4MM_USER / this.Colnum); TableRow rowline = new TableRow( ) { RsidTableRowAddition = "005823AE", RsidTableRowProperties = "00226BAF" }; TableRowHeight rowheight = new TableRowHeight( ) { Val = OpenDocxBase.MM2Uint32V(height) }; rowline.Append(rowheight); int idx = 0; foreach (string line in listing) { idx++; int align = 1; if (idx == 2) { align = 2; } if (idx == 3) { align = 3; } rowline.Append(this.MakeTableCell(line, cellwidt, align)); } this.Tisch.Append(rowline); }
//..................................................................... /// <summary> /// /// </summary> /// <param name="txtline"></param> /// <returns></returns> private TableCell MakeTableCell(string txtline, int widthMM, int align = 1) { UInt32Value uint32ww = OpenDocxBase.MM2Uint32V(widthMM); //............................................. TableCellWidth zellwidth = new TableCellWidth( ) { Width = uint32ww.ToString(), /*widthMM.ToString( ),*/ Type = TableWidthUnitValues.Dxa }; TableCellVerticalAlignment zellVertAlign = new TableCellVerticalAlignment( ) { Val = TableVerticalAlignmentValues.Center }; TableCellProperties zellProperties = new TableCellProperties( ); zellProperties.Append(zellwidth); zellProperties.Append(zellVertAlign); //............................................. Justification justRIGHT = new Justification( ) { Val = JustificationValues.Right }; Justification justCENTER = new Justification( ) { Val = JustificationValues.Center }; ParagraphProperties paraProperties = new ParagraphProperties( ); if (align == 2) { paraProperties.Append(justCENTER); } if (align == 3) { paraProperties.Append(justRIGHT); } //............................................. RunFonts runFonts = new RunFonts( ) { Hint = FontTypeHintValues.EastAsia }; RunProperties textRunProperties = new RunProperties( ); textRunProperties.Append(runFonts); Run runOBJ = new Run( ); runOBJ.Append(textRunProperties); runOBJ.Append(new Text( ) { Text = txtline }); //............................................. Paragraph paragraph = new Paragraph( ) { RsidParagraphAddition = "005823AE", RsidRunAdditionDefault = "005823AE" }; paragraph.Append(paraProperties); paragraph.Append(runOBJ); //............................................. TableCell tableZELL = new TableCell( ); tableZELL.Append(zellProperties); tableZELL.Append(paragraph); return(tableZELL); }