请问,Aspose.Words 是否支持设置文档内表格的 “重复标题行” 的效果?
当文档内一个表格出现跨页之后,出现在新页中的该表格的部分也会自动带有标题行。
相关设定方式和效果的截图我附在附件中了
重复标题行1.png (43.8 KB)
重复标题行2.png (41.9 KB)
请问,Aspose.Words 是否支持设置文档内表格的 “重复标题行” 的效果?
当文档内一个表格出现跨页之后,出现在新页中的该表格的部分也会自动带有标题行。
相关设定方式和效果的截图我附在附件中了
重复标题行1.png (43.8 KB)
重复标题行2.png (41.9 KB)
请使用RowFormat.HeadingFormat属性来满足您的要求。 当此属性为true时,当表跨越多个页面时,该行将作为每页的表标题重复。
以下代码示例显示如何使用此属性。 希望这对您有所帮助。
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
builder.StartTable();
builder.RowFormat.HeadingFormat = true;
builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;
builder.CellFormat.Width = 100;
builder.InsertCell();
builder.Writeln("Heading row 1");
builder.EndRow();
builder.InsertCell();
builder.Writeln("Heading row 2");
builder.EndRow();
builder.CellFormat.Width = 50;
builder.ParagraphFormat.ClearFormatting();
// Insert some content so the table is long enough to continue onto the next page
for (int i = 0; i < 50; i++)
{
builder.InsertCell();
builder.RowFormat.HeadingFormat = false;
builder.Write("Column 1 Text");
builder.InsertCell();
builder.Write("Column 2 Text");
builder.EndRow();
}
doc.Save(ArtifactsDir + "DocumentBuilder.InsertTableSetHeadingRow.docx");
非常感谢,已经验证过了,可行