繁体   English   中英

如何在aspose.word中将标题插入表格和图形

[英]how to insert caption to table and figure in aspose.word

我想创建一个图形表和一个表表,但是第一个表和图应该有标题才能识别。我需要在表和图上插入标题

请尝试使用以下代码。

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一起担任开发人员推广人员。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM