Reputation: 2062
I want to create a table of figure and table of tables but first tables and figures should have caption to be Identify.and I need to insert caption to tables and figure
Upvotes: 0
Views: 919
Reputation: 1090
Please try using the following code.
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");
I work with Aspose as Developer Evangelist.
Upvotes: 2