Skip to main content

ApiDocument

Represents the ApiDocument class.

Methods

MethodReturnsDescription
AcceptAllRevisionChangesbooleanAccepts all changes made in review mode.
AddCheckBoxContentControlApiInlineLvlSdtAdds a new checkbox content control to the document.
AddComboBoxContentControlApiInlineLvlSdtAdds a new combo box content control to the document.
AddCommentApiCommentAdds a comment to the current document selection, or to the current word if no text is selected.
AddDatePickerContentControlApiInlineLvlSdtAdds a new date picker content control to the document.
AddDrawingToPagebooleanAdds a drawing to the specified page. 💡 This method can be a little bit slow, because it runs the document calculation process to arrange tables on the specified page.
AddDropDownListContentControlApiInlineLvlSdtAdds a new drop-down list content control to the document.
AddElementbooleanAdds a paragraph or a table or a blockLvl content control using its position in the document content.
AddEndnoteApiDocumentContentAdds an endnote for the selected text (or the current position if the selection doesn't exist).
AddFootnoteApiDocumentContentAdds a footnote for the selected text (or the current position if the selection doesn't exist).
AddMathEquationbooleanAdds a math equation to the current document.
AddPictureContentControlApiInlineLvlSdtAdds a new picture content control to the document.
AddTableOfContentsbooleanAdds a table of content to the current document. 💡 Please note that the new table of contents replaces the existing table of contents.
AddTableOfFiguresbooleanAdds a table of figures to the current document.
ClearAllFieldsbooleanClears all forms in the document.
CreateNewHistoryPointbooleanCreates a new history point.
CreateNumberingApiNumberingCreates an abstract multilevel numbering with a specified type.
CreateSectionApiSection | nullCreates a new document section which ends at the specified paragraph. Allows to set local parameters to the current section - page size, footer, header, columns, etc.
CreateStyleApiStyleCreates a new style with the specified type and name. If there is a style with the same name it will be replaced with a new one.
DeleteBookmarkbooleanRemoves a bookmark from the document, if one exists.
GetAllBookmarksNamesstring[]Returns an array with names of all bookmarks in the current document.
GetAllCaptionParagraphsApiParagraph[]Returns all caption paragraphs of the specified type from the current document.
GetAllChartsApiChart[]Returns a collection of chart objects from the document content.
GetAllCommentsApiComment[]Returns all comments from the current document.
GetAllContentControlsApiBlockLvlSdt[] | ApiInlineLvlSdt[]Returns a list of all the content controls from the document.
GetAllDrawingObjectsDrawing[]Returns a collection of drawing objects from the document content.
GetAllFormsApiForm[]Returns all existing forms in the document.
GetAllHeadingParagraphsApiParagraph[]Returns all heading paragraphs from the current document.
GetAllImagesApiImage[]Returns a collection of image objects from the document content.
GetAllNumberedParagraphsApiParagraph[]Returns all numbered paragraphs from the current document.
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.
GetAllStylesApiStyle[]Returns all styles of the current document.
GetAllTablesApiTable[]Returns an array of all tables from the current document content.
GetAllTablesOnPageApiTable[]Returns a collection of tables on a given absolute page. 💡 This method can be a little bit slow, because it runs the document calculation process to arrange tables on the specified page.
GetBookmarkApiBookmarkReturns a bookmark by its name from the current document.
GetBookmarkRangeApiRange | nullReturns a bookmark range.
GetClassType"document"Returns a type of the ApiDocument class.
GetCommentByIdApiCommentReturns a comment from the current document by its ID.
GetCommentsReportCommentReportReturns a report about all the comments added to the document.
GetContentDocumentElement[]Returns an array of document elements from the current ApiDocumentContent object.
GetContentControlsByTagApiBlockLvlSdt[] | ApiInlineLvlSdt[]Returns a list of all content controls in the document with the specified tag name.
GetCoreApiCoreRetrieves the core properties interface for the current document. This method is used to view or modify standard metadata such as title, author, and keywords.
GetCurrentContentControlApiBlockLvlSdt | ApiInlineLvlSdt | nullReturns the currently selected content control.
GetCurrentPagenumberReturns the index of the current page.
GetCurrentParagraphApiParagraphReturns the current paragraph where the cursor is located.
GetCurrentRunApiRunReturns the current run where the cursor is located.
GetCurrentSentencestringReturns the current sentence or part of the current sentence.
GetCurrentVisiblePagesnumber[]Returns the indexes of the currently visible pages.
GetCurrentWordstringReturns the current word or part of the current word.
GetCustomPropertiesApiCustomPropertiesRetrieves the custom properties from the document.
GetCustomXmlPartsApiCustomXmlParts | nullRetrieves the custom XML manager associated with the document. This manager allows manipulation and access to custom XML parts within the document.
GetDefaultParaPrApiParaPrReturns a set of default paragraph properties in the current document.
GetDefaultStyleApiStyleReturns the default style parameters for the specified document element.
GetDefaultTextPrApiTextPrReturns a set of default properties for the text run in the current document.
GetDocumentInfoobjectReturns the document information: -Application - the application the document was created with. -CreatedRaw - the date and time when the file was created. -Created - the parsed date and time when the file was created. -LastModifiedRaw - the date and time when the file was last modified. -LastModified - the parsed date and time when the file was last modified. -LastModifiedBy - the name of the user who made the latest change to the document. -Authors - the persons who created the file. -Title - the document title (this property allows you to simplify your documents classification). -Tags - the document tags (this property allows you to simplify your documents classification). -Subject - the document subject (this property allows you to simplify your documents classification). -Comment - the comment to the document (this property allows you to simplify your documents classification).
GetElementDocumentElementReturns an element by its position in the document.
GetElementsCountnumberReturns a number of elements in the current document.
GetEndNotesFirstParagraphsApiParagraph[]Returns the first paragraphs from all endnotes in the current document.
GetFinalSectionApiSectionReturns the document final section.
GetFootnotesFirstParagraphsApiParagraph[]Returns the first paragraphs from all footnotes in the current document.
GetFormKeysByRolestring[]Returns a list of all form keys attached to the specified role.
GetFormValueByKeynull | boolean | stringReturns the form value for the specified key. For a group of radio buttons returns Choice, i.e. the name of the selected item.
GetFormsByKeyApiForm[]Returns a list of all forms in the document with the specified key.
GetFormsByRoleApiForm[]Returns a list of all forms in the document with the specified role name.
GetFormsByTagApiForm[]Returns a list of all forms in the document with the specified tag name.
GetFormsDataFormData[]Returns the data from all forms present in the current document. If a form was created and not assigned to any part of the document, it won't appear in this list.
GetPageCountnumberReturns a number of pages in the current document. 💡 This method can be slow for large documents because it runs the document calculation process before the full recalculation.
GetRangeApiRangeReturns a Range object that represents the part of the document contained in the specified document.
GetRangeBySelectApiRange | nullReturns a range object by the current selection.
GetReviewReportReviewReportReturns a report about every change which was made to the document in the review mode.
GetSectionsApiSection[]Returns a collection of section objects in the document.
GetSelectedDrawingsApiShape[] | ApiImage[] | ApiChart[] | ApiDrawing[]Returns all the selected drawings in the current document.
GetStatisticsobjectReturns the document statistics represented as an object with the following parameters: -PageCount - number of pages; -WordsCount - number of words; -ParagraphCount - number of paragraphs; -SymbolsCount - number of symbols; -SymbolsWSCount - number of symbols with spaces.
GetStyleApiStyleReturns a style by its name.
GetTagsOfAllContentControlsString[]Returns a list of all tags that are used for all content controls in the document.
GetTagsOfAllFormsString[]Returns a list of all tags that are used for all forms in the document.
GetTextstringReturns the inner text of the current document content object.
GetWatermarkSettingsApiWatermarkSettingsReturns the watermark settings in the current document.
GroupDrawingsApiGroupGroups an array of drawings in the current document.
InsertContentbooleanInserts an array of elements into the current position of the document.
InsertWatermarkbooleanInserts a watermark on each document page.
IsTrackRevisionsbooleanChecks if change tracking mode is enabled or not.
LastDocumentElementReturns the last document element.
MoveCursorToPosbooleanMoves a cursor to a specified position of the current document. If there is any selection in the document, it will be removed.
PushbooleanPushes a paragraph or a table to actually add it to the document.
RejectAllRevisionChangesbooleanRejects all changes made in review mode.
RemoveAllElementsbooleanRemoves all the elements from the current document or from the current document element. 💡 When all elements are removed, a new empty paragraph is automatically created. If you want to add content to this paragraph, use the ApiDocumentContent#GetElement method.
RemoveElementbooleanRemoves an element using the position specified.
RemoveSelectionbooleanRemoves the current selection.
RemoveWatermarkbooleanRemoves a watermark from the current document.
ReplaceCurrentImagebooleanReplaces the current image with an image specified.
ReplaceCurrentSentencebooleanReplaces the current sentence or part of the current sentence with the specified text.
ReplaceCurrentWordbooleanReplaces the current word or part of the current word with the specified text.
ReplaceDrawingbooleanReplaces a drawing with a new drawing.
SearchApiRange[]Searches for a scope of a document object. The search results are a collection of ApiRange objects.
SearchAndReplacebooleanFinds and replaces the text.
SelectCurrentWordobjectSelects the current word if it is possible.
SetControlsHighlightbooleanSets the highlight to the content controls from the current document.
SetEvenAndOddHdrFtrbooleanSpecifies whether sections in this document will have different headers and footers for even and odd pages (one header/footer for odd pages and another header/footer for even pages).
SetFormsDatabooleanSets the data to the specified forms.
SetFormsHighlightbooleanSets the highlight to the forms in the document.
SetTrackRevisionsbooleanSets the change tracking mode.
SetWatermarkSettingsApiDrawingSets the watermark settings in the current document.
ToHtmlstringConverts a document to HTML.
ToJSONJSONConverts the ApiDocument object into the JSON object.
ToMarkdownstringConverts a document to Markdown.
UpdateAllFieldsbooleanUpdates all fields in the document.
UpdateAllTOCbooleanUpdates all tables of contents in the current document.
UpdateAllTOFbooleanUpdates all tables of figures in the current document.