GetContent
function GetContent(bGetCopies: any = null): void
Description
Returns an array of document elements from the current ApiDocumentContent object.
Parameters
- bGetCopies
any
null Specifies if the copies of the document elements will be returned or not.
Returns
void
Try It
var oDocument = Api.GetDocument();
var oParagraph = oDocument.GetElement(0);
var oFill = Api.CreateSolidFill(Api.CreateRGBColor(255, 111, 61));
var oStroke = Api.CreateStroke(0, Api.CreateNoFill());
var oShape = Api.CreateShape("rect", 100 * 36000, 100 * 36000, oFill, oStroke);
oParagraph.AddDrawing(oShape);
var oDocContent = oShape.GetDocContent();
oParagraph = Api.CreateParagraph();
oParagraph.AddText("This paragraph is the first document element.");
oDocContent.AddElement(0, oParagraph);
var oTableStyle = oDocument.CreateStyle("CustomTableStyle", "table");
oTableStyle.SetBasedOn(oDocument.GetStyle("Bordered"));
var oTable = Api.CreateTable(2, 2);
oTable.SetWidth("percent", 100);
oTable.SetStyle(oTableStyle);
oDocContent.AddElement(1, oTable);
oParagraph = Api.CreateParagraph();
oParagraph.AddText("This table is the second document element.");
var oCell = oTable.GetCell(0,0);
oTable.AddElement(oCell, 0, oParagraph);
var oBlockLvlSdt = Api.CreateBlockLvlSdt();
oBlockLvlSdt.GetContent().GetElement(0).AddText("This block text content control is the third document element.");
oDocContent.AddElement(2, oBlockLvlSdt);
var aDocElements = oDocContent.GetContent(false);
aDocElements[0].SetBold(true);
aDocElements[1].SetBackgroundColor(235, 235, 235, false);
aDocElements[2].Search("block text content control")[0].SetBold(true);