Api
The main class of the Document API. Use it to get the current document and to create document elements, such as paragraphs, tables, images, and charts.
Methods
The following table lists the available methods.
| Method | Returns | Description |
|---|---|---|
| AddComment | ApiComment | Adds a comment to the specifed document element or array of Runs. |
| AutoColor | ApiColor | Creates an auto-color. |
| CentimetersToPoints | number | Converts centimeters to points. |
| Color | ApiColor | Creates an ApiColor from a universal input. |
| CompareDocuments | None | Compares the current document with another document opened via builderJS.OpenTmpFile. |
| ConvertDocument | string | Converts a document to Markdown or HTML text. |
| CreateBlipFill | ApiFill | Creates a blip fill to apply to the object using the selected image as the object background. |
| CreateBlockLvlSdt | ApiBlockLvlSdt | Creates a new block level container. |
| CreateChart | ApiChart | Creates a chart with the parameters specified. |
| CreateCheckBoxContentControl | ApiInlineLvlSdt | Creates a checkbox content control. |
| CreateComboBoxContentControl | ApiInlineLvlSdt | Creates a new combo box container with the given list of options. |
| CreateCustomGeometry | ApiGeometry | Creates a new custom geometry. |
| CreateDatePickerContentControl | ApiInlineLvlSdt | Creates a new date picker content control. |
| CreateDropDownListContentControl | ApiInlineLvlSdt | Creates a new drop-down list container with the given list of options. |
| CreateGradientStop | ApiGradientStop | Creates a gradient stop used for different types of gradients. |
| CreateGroup | ApiGroup | Groups an array of drawings. |
| CreateHyperlink | ApiHyperlink | Creates a new hyperlink text block to be inserted to the current paragraph or table. |
| CreateImage | ApiImage | Creates an image with the parameters specified. |
| CreateInlineLvlSdt | ApiInlineLvlSdt | Creates a new inline container. |
| CreateLinearGradientFill | ApiFill | Creates a linear gradient fill to apply to the object using the selected linear gradient as the object background. |
| CreateNoFill | ApiFill | Creates no fill and removes the fill from the element. |
| CreateNumbering | ApiNumbering | Creates an abstract multilevel numbering with a specified type. |
| CreateOleObject | ApiOleObject | Creates an OLE object with the parameters specified. |
| CreateParaPr | ApiParaPr | Creates the empty paragraph properties. |
| CreateParagraph | ApiParagraph | Creates a new paragraph. |
| CreatePatternFill | ApiFill | Creates a pattern fill to apply to the object using the selected pattern as the object background. |
| CreatePictureContentControl | ApiInlineLvlSdt | Creates a new picture container. |
| CreatePresetColor | ApiPresetColor | Creates a color selecting it from one of the available color presets. |
| CreatePresetGeometry | ApiGeometry | null | Creates a geometry using one of the available preset shapes. |
| CreateRGBColor | ApiRGBColor | Creates an RGB color setting the appropriate values for the red, green and blue color components. |
| CreateRadialGradientFill | ApiFill | Creates a radial gradient fill to apply to the object using the selected radial gradient as the object background. |
| CreateRange | ApiRange | null | Creates an element range. |
| CreateRun | ApiRun | Creates a new smaller text block to be inserted to the current paragraph or table. |
| CreateSchemeColor | ApiSchemeColor | Creates a complex color scheme selecting from one of the available schemes. |
| CreateShape | ApiShape | Creates a shape with the parameters specified. |
| CreateSolidFill | ApiFill | Creates a solid fill to apply to the object using a selected solid color as the object background. |
| CreateStroke | ApiStroke | Creates a stroke adding shadows to the element. |
| CreateTable | ApiTable | Creates a new table with a specified number of rows and columns. |
| CreateTableCellPr | ApiTableCellPr | Creates the empty table cell properties. |
| CreateTablePr | ApiTablePr | Creates the empty table properties. |
| CreateTableRowPr | ApiTableRowPr | Creates the empty table row properties. |
| CreateTableStylePr | ApiTableStylePr | Creates the empty table style properties. |
| CreateTextPr | ApiTextPr | Creates the empty text properties. |
| CreateWordArt | ApiDrawing | Creates a Text Art object with the parameters specified. |
| EmusToMillimeters | mm | Converts English Metric Units (EMUs) to millimeters. |
| EmusToPoints | number | Converts EMUs (English Metric Units) to points. |
| FromJSON | object | Converts the specified JSON object into the Document Builder object of the corresponding type. |
| GetByInternalId | object | Returns the object by it's internal ID. |
| GetDocument | ApiDocument | Returns the main document. |
| GetFullName | string | Returns the full name of the currently opened file. |
| GetMailMergeReceptionsCount | number | Returns the mail merge receptions count. |
| GetMailMergeTemplateDocContent | ApiDocumentContent | Returns the mail merge template document. |
| HexColor | ApiColor | Creates a color from a HEX string. |
| InchesToPoints | number | Converts inches to points. |
| LinesToPoints | number | Converts lines to points (1 line = 12 points). |
| LoadMailMergeData | boolean | Loads data for the mail merge. |
| MailMerge | boolean | Starts the mail merge process. |
| MergeDocuments | None | Merges the current document with another document opened via builderJS.OpenTmpFile. |
| MillimetersToEmus | EMU | Converts millimeters to English Metric Units (EMUs). |
| MillimetersToPixels | number | Converts millimeters to pixels. |
| MillimetersToPoints | number | Converts millimeters to points. |
| PicasToPoints | number | Converts picas to points. |
| PixelsToEmus | number | Converts pixels to EMUs (English Metric Units). |
| PixelsToPoints | number | Converts pixels to points. |
| PointsToCentimeters | number | Converts points to centimeters. |
| PointsToEmus | number | Converts points to EMUs (English Metric Units). |
| PointsToInches | number | Converts points to inches. |
| PointsToLines | number | Converts points to lines (1 line = 12 points). |
| PointsToMillimeters | number | Converts points to millimeters. |
| PointsToPicas | number | Converts points to picas (1 pica = 12 points). |
| PointsToPixels | number | Converts points to pixels. |
| PointsToTwips | number | Converts points to twips. |
| RGB | ApiColor | Creates an RGB color from red, green and blue components. |
| RGBA | ApiColor | Creates an RGBA color from red, green, blue and alpha components. |
| ReplaceDocumentContent | boolean | Replaces the main document content with another document content. |
| ReplaceTextSmart | boolean | Replaces each paragraph (or text in cell) in the select with the corresponding text from an array of strings. |
| Save | boolean | Saves changes to the specified document. |
| ThemeColor | ApiColor | Creates a theme color. |
| TwipsToPoints | number | Converts twips to points. |
| attachEvent | None | Subscribes to the specified event and calls the callback function when the event fires. |
| detachEvent | None | Unsubscribes from the specified event. |