簡體   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