Class representing a document.
Name | Description |
AcceptAllRevisionChanges | Accepts all changes made in review mode. |
AddComment | Adds a comment to the document. |
AddDrawingToPage | Adds a shape to the specified page.
|
AddElement | Adds a paragraph or a table or a blockLvl content control using its position in the document content. |
AddEndnote | Adds an endnote for the selected text (or the current position if the selection doesn't exist). |
AddFootnote | Adds a footnote for the selected text (or the current position if the selection doesn't exist). |
AddTableOfContents | Adds a table of content to the current document.
|
AddTableOfFigures | Adds a table of figures to the current document. |
ClearAllFields | Clears all forms in the document. |
CreateNewHistoryPoint | Creates a new history point. |
CreateNumbering | Creates an abstract multilevel numbering with a specified type. |
CreateSection | Creates 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. |
CreateStyle | Creates 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. |
DeleteBookmark | Removes a bookmark from the document, if one exists. |
GetAllBookmarksNames | Returns an array with names of all bookmarks in the current document. |
GetAllCaptionParagraphs | Returns all caption paragraphs of the specified type from the current document. |
GetAllCharts | Returns a collection of chart objects from the document content. |
GetAllComments | Returns all comments from the current document. |
GetAllContentControls | Returns a list of all the content controls from the document. |
GetAllDrawingObjects | Returns a collection of drawing objects from the document content. |
GetAllForms | Returns all existing forms in the document. |
GetAllHeadingParagraphs | Returns all heading paragraphs from the current document. |
GetAllImages | Returns a collection of image objects from the document content. |
GetAllNumberedParagraphs | Returns all numbered paragraphs from the current document. |
GetAllOleObjects | Returns a collection of OLE objects from the document content. |
GetAllParagraphs | Returns an array of all paragraphs from the current document content. |
GetAllShapes | Returns a collection of shape objects from the document content. |
GetAllStyles | Returns all styles of the current document. |
GetAllTables | Returns an array of all tables from the current document content. |
GetAllTablesOnPage | Returns a collection of tables on a given absolute page.
|
GetBookmarkRange | Returns a bookmark range. |
GetClassType | Returns a type of the ApiDocument class. |
GetCommentById | Returns a comment from the current document by its ID. |
GetCommentsReport | Returns a report about all the comments added to the document. |
GetContent | Returns an array of document elements from the current ApiDocumentContent object. |
GetContentControlsByTag | Returns a list of all content controls in the document with the specified tag name. |
GetDefaultParaPr | Returns a set of default paragraph properties in the current document. |
GetDefaultStyle | Returns the default style parameters for the specified document element. |
GetDefaultTextPr | Returns a set of default properties for the text run in the current document. |
GetElement | Returns an element by its position in the document. |
GetElementsCount | Returns a number of elements in the current document. |
GetEndNotesFirstParagraphs | Returns the first paragraphs from all endnotes in the current document. |
GetFinalSection | Returns the document final section. |
GetFootnotesFirstParagraphs | Returns the first paragraphs from all footnotes in the current document. |
GetFormsByTag | Returns a list of all forms in the document with the specified tag name. |
GetFormsData | 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. |
GetPageCount | Returns a number of pages in the current document.
|
GetRange | Returns a Range object that represents the part of the document contained in the specified document. |
GetRangeBySelect | Returns a range object by the current selection. |
GetReviewReport | Returns a report about every change which was made to the document in the review mode. |
GetSections | Returns a collection of section objects in the document. |
GetSelectedDrawings | Returns all the selected drawings in the current document. |
GetStatistics | Returns the document statistics represented as an object with the following parameters:
|
GetStyle | Returns a style by its name. |
GetTagsOfAllContentControls | Returns a list of all tags that are used for all content controls in the document. |
GetTagsOfAllForms | Returns a list of all tags that are used for all forms in the document. |
GetWatermarkSettings | Returns the watermark settings in the current document. |
InsertContent | Inserts an array of elements into the current position of the document. |
InsertWatermark | Inserts a watermark on each document page. |
IsTrackRevisions | Checks if change tracking mode is enabled or not. |
Last | Returns the last document element. |
Push | Pushes a paragraph or a table to actually add it to the document. |
RejectAllRevisionChanges | Rejects all changes made in review mode. |
RemoveAllElements | Removes all the elements from the current document or from the current document element.
|
RemoveElement | Removes an element using the position specified. |
RemoveSelection | Removes the current selection. |
RemoveWatermark | Removes a watermark from the current document. |
ReplaceCurrentImage | Replaces the current image with an image specified. |
ReplaceDrawing | Replaces a drawing with a new drawing. |
Search | Searches for a scope of a document object. The search results are a collection of ApiRange objects. |
SearchAndReplace | Finds and replaces the text. |
SetControlsHighlight | Sets the highlight to the content controls from the current document. |
SetEvenAndOddHdrFtr | Specifies 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). |
SetFormsData | Sets the data to the specified forms. |
SetFormsHighlight | Sets the highlight to the forms in the document. |
SetTrackRevisions | Sets the change tracking mode. |
SetWatermarkSettings | Sets the watermark settings in the current document. |
ToHtml | Converts a document to HTML. |
ToJSON | Converts the ApiDocument object into the JSON object. |
ToMarkdown | Converts a document to Markdown. |
UpdateAllTOC | Updates all tables of contents in the current document. |
UpdateAllTOF | Updates all tables of figures in the current document. |
builder.CreateFile("docx"); var oDocument = Api.GetDocument(); var oNoSpacingStyle = oDocument.GetStyle("No Spacing"); var oSection = oDocument.GetFinalSection(); var oHeader = oSection.GetHeader("default", true); var oParagraph = oHeader.GetElement(0); oParagraph.AddText("This is the text in the default header"); var oTextPr = oDocument.GetDefaultTextPr(); oTextPr.SetFontSize(22); oTextPr.SetLanguage("en-US"); oTextPr.SetFontFamily("Calibri"); var oParaPr = oDocument.GetDefaultParaPr(); oParaPr.SetSpacingLine(276, "auto"); oParaPr.SetSpacingAfter(200); var oNormalStyle = oDocument.GetDefaultStyle("paragraph"); oParaPr = oNormalStyle.GetParaPr(); oParaPr.SetSpacingLine(240, "auto"); oParaPr.SetJc("both"); oTextPr = oNormalStyle.GetTextPr(); oTextPr.SetColor(0x26, 0x26, 0x26, false); var oHeading1Style = oDocument.CreateStyle("Heading 1", "paragraph"); oParaPr = oHeading1Style.GetParaPr(); oParaPr.SetKeepNext(true); oParaPr.SetKeepLines(true); oParaPr.SetSpacingAfter(240); oTextPr = oHeading1Style.GetTextPr(); oTextPr.SetColor(0xff, 0x68, 0x00, false); oTextPr.SetFontSize(40); oTextPr.SetFontFamily("Calibri Light"); oParagraph = oDocument.GetElement(0); oParagraph.SetStyle(oHeading1Style); oParagraph.AddText("This is a heading"); oParagraph = Api.CreateParagraph(); var oRun = Api.CreateRun(); oRun.AddText("Number of paragraph elements at this point: "); oRun.AddTabStop(); oRun.AddText("" + oParagraph.GetElementsCount()); oRun.AddLineBreak(); oParagraph.AddElement(oRun); oRun.AddText("Number of paragraph elements after we added a text run: "); oRun.AddTabStop(); oRun.AddText("" + oParagraph.GetElementsCount()); oDocument.Push(oParagraph); var oNumbering = oDocument.CreateNumbering("bullet"); for (let nLvl = 0; nLvl < 8; ++nLvl) { var oNumLvl = oNumbering.GetLevel(nLvl); oParagraph = Api.CreateParagraph(); oParagraph.AddText("Default bullet lvl " + (nLvl + 1)); oParagraph.SetNumbering(oNumLvl); oParagraph.SetContextualSpacing(true); oDocument.Push(oParagraph); } builder.SaveFile("docx", "ApiDocument.docx"); builder.CloseFile();