Skip to main content

AddTableOfFigures

Adds a table of figures to the current document.

note

Please note that the table of figures properties will be filled with the default properties if they are undefined.

Syntax​

expression.AddTableOfFigures(oTofPr, oRange);

expression - A variable that represents an ApiDocument class.

Parameters​

NameRequired/OptionalData typeDefaultDescription
oTofPrOptionalTofPr{}Table of figures properties.
oRangeOptionalApiRangeThe range that the table of figures replaces. If omitted, the table of figures is inserted at the current position.

Returns​

ApiTableOfFigures | null | undefined

Example​

Generate a table of figures from captioned drawings in a document.

// Add a captioned chart, then add an anchor paragraph where the table of figures should appear.

// Insert the table of figures so it replaces the anchor range.

let doc = Api.GetDocument();
let paragraph = doc.GetElement(0);
let drawing = Api.CreateChart("3DColumnClustered", [
[200, 240, 280],
[250, 260, 280]
], ["Projected Revenue", "Estimated Costs"], [2014, 2015, 2016], 4051300, 2347595, 24);
drawing.SetVerAxisTitle("USD In Hundred Thousands", 20);
drawing.SetHorAxisTitle("Year", 22);
drawing.SetLegendPos("bottom");
drawing.SetShowDataLabels(false, false, true, false);
drawing.SetTitle("Financial Overview", 26);
let fill = Api.CreateSolidFill(Api.RGB(51, 51, 51));
drawing.SetSeriesFill(fill, 0, false);
fill = Api.CreateSolidFill(Api.RGB(255, 111, 61));
drawing.SetSeriesFill(fill, 1, false);
paragraph.AddDrawing(drawing);
paragraph.AddCaption(" - Financial Overview", "Figure", false, "Arabic", false, undefined, "hyphen");
let anchor = Api.CreateParagraph();
anchor.AddText("Table of figures goes here");
doc.Push(anchor);
let tofPr = {"ShowPageNums": true, "RightAlgn": true, "LeaderType": "dot", "FormatAsLinks": true, "BuildFrom": "Figure", "LabelNumber": true, "TofStyle": "distinctive"};
doc.AddTableOfFigures(tofPr, anchor.GetRange());