var row = new Aspose.Pdf.Row();
row.Cells.Add($“\t\t 单元格缩进无效\n,跨行有效”);
好的,示例片段:
var doc1 = new Aspose.Pdf.Document();
// 创建一个Table对象
Page page = doc1.Pages.Add();
var margin = new MarginInfo(80, 0, 80, 80);
page.PageInfo.Margin = margin;
Table table1 = new Table();
{
// 设置单元格边距
table1.DefaultCellPadding = new MarginInfo(1, 2, 2, 2);
table1.Border = new BorderInfo(BorderSide.None, .5f);
table1.DefaultCellBorder = new BorderInfo(BorderSide.None, .5f);
table1.DefaultCellBorder.Bottom = graph;
table1.DefaultCellTextState = defaultTextState;
//table.Border.Bottom = graph;
// 添加6列
table1.ColumnWidths = "120, 110, 80, 40, 40 50";
}
{//描述
var rowR = table.Rows.Add();
rowR.Cells.Add($"\t\t 庆历四年春,滕子京谪守巴陵郡。越明年,政通人和,百废具兴,乃重修岳阳楼,增其旧制,刻唐贤今人诗赋于其上,属予作文以记之。予观夫巴陵胜状,在洞庭一湖。衔远山,吞长江,浩浩汤汤,横无际涯,朝晖夕阴,气象万千,此则岳阳楼之大观也,前人之述备矣。然则北通巫峡,南极潇湘,迁客骚人,多会于此,览物之情,得无异乎?\n");
var textState = new TextState(familyName, false, false);
textState.FontSize = 10.6f;
textState.ForegroundColor = Aspose.Pdf.Color.Black;
textState.LineSpacing = 10f;
var cell = AsposePdfHelper.GetCell(rowR, 0, textBrush: textState,
horizontalAlignment: Aspose.Pdf.HorizontalAlignment.Left,
verticalAlignment: Aspose.Pdf.VerticalAlignment.Center);
cell.ColSpan = 6;
rowR.DefaultCellPadding = new MarginInfo();
rowR.DefaultCellPadding.Bottom = 2;
}
page1.Paragraphs.Add(table1);
doc1.Save("TestPDFAddTable.pdf");