问题描述
用aspose.words插入表格时,设置表格宽度为什么没有起作用呢。这样导致插入的表格样式不好看。voidInsertDataTable(Documentdoc,stringbookmark,DataTabledt){Aspose.Words.DocumentBuilderbuilder=newAspose.Words.DocumentBuilder(doc);boolisbool=builder.MoveToBookmark(bookmark);if(isbool){builder.StartTable();builder.RowFormat.Alignment=RowAlignment.Center;builder.CellFormat.Borders.LineStyle=LineStyle.Single;builder.CellFormat.Borders.Color=Color.Black;builder.RowFormat.LeftIndent=5;//builder.RowFormat.RightPadding=50;builder.Bold=true;builder.RowFormat.Height=20;builder.CellFormat.Width=100;foreach(DataColumncolumnindt.Columns){builder.InsertCell();builder.CellFormat.VerticalMerge=Aspose.Words.Tables.CellMerge.None;builder.CellFormat.VerticalAlignment=CellVerticalAlignment.Center;//垂直居中对齐builder.ParagraphFormat.Alignment=ParagraphAlignment.Center;//水平居中对齐builder.CellFormat.Width=100;builder.Write(column.ColumnName);}builder.EndRow();builder.RowFormat.Height=20;//builder.RowFormat.HeightRule=HeightRule.Auto;builder.Bold=false;foreach(DataRowrowindt.Rows){foreach(DataColumncolumnindt.Columns){builder.InsertCell();builder.CellFormat.VerticalMerge=Aspose.Words.Tables.CellMerge.None;builder.CellFormat.VerticalAlignment=CellVerticalAlignment.Center;//垂直居中对齐builder.ParagraphFormat.Alignment=ParagraphAlignment.Center;//水平居中对齐builder.Write(row[column.ColumnName].ToString());}builder.EndRow();}builder.EndTable();}}
解决方案
解决方案二:
没有人用这个控件吗?