Adds a caption paragraph after (or before) the current table.
Name | Type | Default | Description |
sAdditional | string | The additional text. |
|
sLabel | CaptionLabel | String | "Table" | The caption label. |
bExludeLabel | boolean | false | Specifies whether to exclude the label from the caption. |
sNumberingFormat | CaptionNumberingFormat | "Arabic" | The possible caption numbering format. |
bBefore | boolean | false | Specifies whether to insert the caption before the current table (true) or after (false) (after/before the shape if it is placed in the shape). |
nHeadingLvl | Number | null | The heading level (used if you want to specify the chapter number).
|
sCaptionSep | CaptionSep | "hyphen" | The caption separator (used if you want to specify the chapter number). |
builder.CreateFile("docx"); var oDocument = Api.GetDocument(); var oTableStyle = oDocument.CreateStyle("CustomTableStyle", "table"); oTableStyle.SetBasedOn(oDocument.GetStyle("Bordered")); var oTable = Api.CreateTable(3, 3); oTable.SetWidth("percent", 100); oTable.SetStyle(oTableStyle); oDocument.Push(oTable); var oParagraph = Api.CreateParagraph(); oParagraph.AddText("This is just a sample text in the first cell."); var oCell = oTable.GetCell(0,0); oTable.AddElement(oCell, 0, oParagraph); oTable.AddCaption("", "Table", false, "Arabic", false, undefined, "hyphen"); builder.SaveFile("docx", "AddCaption.docx"); builder.CloseFile();