我想创建一个图表和表格表格,但是第一个表格和数字应该有标题标识。我需要在表格和图形中插入标题
答案 0 :(得分:2)
请尝试使用以下代码。
Document doc = new Document(MyDir + "in.docx");
DocumentBuilder builder = new DocumentBuilder(doc);
builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;
// Insert caption above the Table
builder.MoveTo(doc.FirstSection.Body.Tables[0].PreviousSibling);
builder.Write("Table: ");
builder.InsertField(@"SEQ Table \* ARABIC", "");
// Insert caption below the Figure
builder.MoveToDocumentEnd();
builder.InsertParagraph();
builder.Write("Figure: ");
builder.InsertField(@"SEQ Figure \* ARABIC", "");
doc.UpdateFields();
doc.Save(MyDir + @"17.11.docx");
我与Aspose一起担任开发者布道者。