Skip to main content

ApiDocumentContent

Class representing a container for paragraphs and tables.

Methods​

The following table lists the available methods.

MethodReturnsDescription
AddElementbooleanAdds a paragraph or a table or a blockLvl content control using its position in the document content.
AddParagraphApiParagraphCreates a new paragraph and appends it to the end of the document content.
AddTextApiRunAppends the specified text to the end of the document content.
GetAllChartsApiChart[]Returns a collection of chart objects from the document content.
GetAllDrawingObjectsDrawing[]Returns a collection of drawing objects from the document content.
GetAllImagesApiImage[]Returns a collection of image objects from the document content.
GetAllOleObjectsApiOleObject[]Returns a collection of OLE objects from the document content.
GetAllParagraphsApiParagraph[]Returns an array of all paragraphs from the current document content.
GetAllShapesApiShape[]Returns a collection of shape objects from the document content.
GetAllTablesApiTable[]Returns an array of all tables from the current document content.
GetClassType"documentContent"Returns a type of the ApiDocumentContent class.
GetContentDocumentElement[]Returns an array of document elements from the current ApiDocumentContent object.
GetCurrentContentControlApiBlockLvlSdt | ApiInlineLvlSdt | nullReturns the currently selected content control.
GetCurrentParagraphApiParagraphReturns the current paragraph where the cursor is located.
GetCurrentRunApiRunReturns the current run where the cursor is located.
GetDocumentVisitorApiDocumentVisitorReturns a visitor object for traversing the elements of the current document.
GetElementDocumentElementReturns an element by its position in the document.
GetElementsCountnumberReturns a number of elements in the current document.
GetInternalIdstringReturns an internal ID of the current document content.
GetRangeApiRangeReturns a Range object that represents the part of the document contained in the document content.
GetTextstringReturns the inner text of the current document content object.
IsEndnotebooleanCheck if the current document content is an endnote.
IsFootnotebooleanCheck if the current document content is a footnote.
MoveCursorToNoteReferencebooleanMoves the cursor to the reference of this footnote/endnote in the main document.
PushbooleanPushes a paragraph or a table to actually add it to the document.
RemoveAllElementsbooleanRemoves all the elements from the current document or from the current document element.
RemoveElementbooleanRemoves an element using the position specified.
SelectNoteReferencebooleanSelects the reference to this footnote/endnote.
SetTextApiRunReplaces all content of the current document content object with the specified text, preserving the formatting of the first paragraph.
ToJSONJSONConverts the ApiDocumentContent object into the JSON object.