Get Started
Usage API
More information
|
Global type definitionsAngleSpecifies the range angle. Type:
Example// Specify that the range contents will be rotated upward: oWorksheet.GetRange("A1").SetOrientation("xlUpward"); ApiFormTypes of all supported forms. Type:Example// Copies a text form var oCopyTextForm = oTextForm.Copy(); AxisPosAxis position in the chart. Type:
Example// Set the axis values to the top position of the chart: oChart.SetAxieNumFormat("top", "0.00"); BlipFillTypeThe type of a fill which uses an image as a background.
Type:
Example// Create a blip fill with an image which is tiled all over the created shape: var oFill = Api.CreateBlipFill("https://example.com/myimage.png", "tile"); bookmarkRefToAvailable values of the "bookmark" reference type:
Type:
Example// Add a cross-reference to the page containing a bookmark: oParagraph.AddBookmarkCrossRef("pageNum", sBookmark); BordersIndexSpecifies the cell border position. Type:
Example// The cell will have a bottom black dotted border: oWorksheet.GetRange("E2").SetBorders("Bottom", "Dotted", Api.CreateColorFromRGB(0, 0, 0)); BorderTypeA border type. Type:
Example// The paragraph will have a single 3 point wide green bottom border with a zero offset from the bottom paragraph edge: oParaPr.SetBottomBorder("single", 24, 0, 0, 255, 0); BulletTypeA bullet type which will be added to the paragraph in spreadsheet or presentation. Type:
Example// The paragraph will be starting with the Arabic numeral which has parenthesis: var oBullet = Api.CreateNumbering("ArabicParenR"); byteA numeric value from 0 to 255. Type:
Example// The resulting color is green, the bytes are measured in decimal numbers: var oRGBColor = Api.CreateRGBColor(0, 255, 0); // The resulting color is green, the bytes are measured in hexadecimal numbers: var oRGBColor = Api.CreateRGBColor(0, 0xff, 0); CaptionLabelPossible values for the caption label. Type:
Example// Add a cross-reference to the page containing a table caption: oParagraph.AddCaptionCrossRef("Table", "pageNum", oCaptionParagraph); CaptionNumberingFormatPossible values for the caption numbering format.
Type:
Example// Add a caption with the Arabic numbering format to the paragraph: oParagraph.AddCaption("", "Figure", false, "Arabic", false, undefined, "hyphen"); captionRefToAvailable values of the "equation"/"figure"/"table" reference type:
Type:
Example// Add a cross-reference to the page containing a table caption: oParagraph.AddCaptionCrossRef("table", "pageNum", oCaptionParagraph); CaptionSepPossible values for the caption separator.
Type:
Example// Add a caption with a hyphen as a numbering separator to the paragraph: oParagraph.AddCaption("", "Figure", false, "Arabic", false, undefined, "hyphen"); ChartTypeThis type specifies the available chart types which can be used to create a new chart. Type:
Example// ChartType used in text documents // The resulting chart will have a 'bar3D' type: var oChart = Api.CreateChart("bar3D", [[200, 240, 280],[250, 260, 280]], ["Projected Revenue", "Estimated Costs"], [2014, 2015, 2016], 4051300, 2347595, 24); // ChartType used in spreadsheets // The resulting chart will have a 'bar3D' type: var oChart = oWorksheet.AddChart("'Sheet1'!$A$1:$D$3", true, "bar3D", 2, 100 * 36000, 70 * 36000, 0, 2 * 36000, 7, 3 * 36000); CheckBoxFormPrCheckbox / radio button properties. Type:Example// Create a checkbox form with the common and specific checkbox form properties: var oCheckBoxFormPr = {"key": "Marital status", "tip": "Specify your marital status", "required": true, "placeholder": "Marital status", "radio": true}; var oCheckBoxForm = Api.CreateCheckBoxForm(oCheckBoxFormPr); CheckBoxFormPrBaseSpecific checkbox / radio button properties. Type:
Properties:
Example// Create a checkbox form with the specific checkbox form properties: var oCheckBoxFormPrBase = {"radio": true}; var oCheckBoxForm = Api.CreateCheckBoxForm(oCheckBoxFormPrBase); ComboBoxFormPrCombo box / dropdown list properties. Type:Example// Create a combo box form with the common and specific combo box form properties: var oComboBoxFormPr = {"key": "Personal information", "tip": "Choose your country", "required": true, "placeholder": "Country", "editable": false, "autoFit": false, "items": ["Latvia", "USA", "UK"]}; var oComboBoxForm = Api.CreateComboBoxForm(oComboBoxFormPr); ComboBoxFormPrBaseSpecific combo box / dropdown list properties. Type:
Properties:
Example// Create a combo box form with the specific combo box form properties: var oComboBoxFormPrBase = {"editable": false, "autoFit": false, "items": ["Latvia", "USA", "UK"]}; var oComboBoxForm = Api.CreateComboBoxForm(oComboBoxFormPrBase); DirectionSpecifies the direction of end in the specified range. Type:
Example// Return a Range object that represents the left end of the specified range: oWorksheet.GetRange("C4:D5").End("xlToLeft").SetFillColor(Api.CreateColorFromRGB(255, 224, 204)); DocumentElementAny valid element which can be added to the document structure. Type:Example// Add a document element called 'paragraph' to the document: oDocument.AddElement(oParagraph); EMUEnglish measure unit. 1 mm = 36000 EMUs, 1 inch = 914400 EMUs. Type:
Example// Set the size of the drawing to be created as 100 mm (10 cm) in width and 100 mm (10 cm) in height: oDrawing.SetSize(100 * 36000, 100 * 36000); endnoteRefToAvailable values of the "endnote" reference type:
Type:
Example// Add a cross-reference to the page containing an endnote: oParagraph.AddEndnoteCrossRef("pageNum", oEndnoteParagraph); footnoteRefToAvailable values of the "footnote" reference type:
Type:
Example// Add a cross-reference to the page containing a footnote: oParagraph.AddFootnoteCrossRef("pageNum", oFootnoteParagraph); FormInsertPrForm insertion specific properties. Type:
Properties:
Example// Insert a text box with the specified text box properties over the selected text: var oTextFormInsertPr = {"key": "Personal information", "tip": "Enter your first name", "required": true, "placeholder": "Name", "comb": true, "maxCharacters": 10, "cellWidth": 3, "multiLine": false, "autoFit": false, "placeholderFromSelection": true, "keepSelectedTextInForm": false}; oDocument.InsertTextForm(oTextFormInsertPr); FormPrBaseCommon form properties. Type:
Properties:
Example// Create a text form with the common form properties: var oFormPrBase = {"key": "Personal information", "tip": "Enter your first name", "required": true, "placeholder": "First name"}; var oTextForm = Api.CreateTextForm(oFormPrBase); FormTypeForm type. The available form types. Type:
Example// Return a type of the current form: var sFormType = oTextForm.GetFormType(); HdrFtrTypeHeader and footer types which can be applied to the document sections.
Type:
Example// Remove the header of the 'title' type from the final document section: var oDocContent = oFinalSection.RemoveHeader("title"); headingRefToAvailable values of the "heading" reference type:
Type:
Example// Add a cross-reference to the page containing a heading: oParagraph.AddHeadingCrossRef("pageNum", oHeadingParagraph); highlightColorAvailable highlight colors. Type:
Example// Highlight a paragraph in green: oParagraph.SetHighlight("green"); hpsHalf-points (2 half-points = 1 point). Type:
Example// Set the text font size to 22 half-points: oTextPr.SetFontSize(22); line240240ths of a line. Type:
Example// The paragraph line spacing is set to 1 line: oParaPr.SetSpacingLine(240, "auto"); LineStyleSpecifies the line style used to form the cell border. Type:
Example// The cell will have a bottom black dotted border: oWorksheet.GetRange("E2").SetBorders("Bottom", "Dotted", Api.CreateColorFromRGB(0, 0, 0)); mm1 millimetre equals 1/10th of a centimetre. Type:
Example// Set the cell width measured in millimeters to the applied comb of characters: oTextForm.SetCellWidth(7); numberedRefToAvailable values of the "numbered" reference type:
Type:
Example// Add a cross-reference to the page containing a numbered paragraph: oParagraph.AddNumberedCrossRef("pageNum", oNumberedParagraph, true, true); NumFormatStandard numeric format. Type:
Example// Set the "0.00" numeric format to the chart data point: oChart.SetDataPointNumFormat("0.00", 0, 1, true); PageOrientationThe page orientation type. Type:
Example// Set the page orientation to portrait: oWorksheet.SetPageOrientation("xlPortrait"); ParagraphContentThe types of elements that can be added to the paragraph structure. Type:Example// Add an element called 'text run' to the paragraph: oParagraph.AddElement(oRun,0); PatternTypeThe available preset patterns which can be used for the fill. Type:
Example// Create a fill with a 'dashDnDiag' pattern which has two colors - green and red: var oFill = Api.CreatePatternFill("dashDnDiag", Api.CreateRGBColor(0, 225, 0), Api.CreateRGBColor(255, 0, 0)); percentageValue from 0 to 100. Type:
Example// Set the picture position measured in percent inside the current form: oPictureForm.SetPicturePosition(70, 70); PictureFormPrPicture form properties. Type:Example// Create a picture form with the common and specific picture form properties: var oPictureFormPr = {"key": "Personal information", "tip": "Upload your photo", "required": true, "placeholder": "Photo", "scaleFlag": "tooBig", "lockAspectRatio": true, "respectBorders": false, "shiftX": 50, "shiftY": 50}; var oPictureForm = Api.CreatePictureForm(oPictureFormPr); PictureFormPrBaseSpecific picture form properties. Type:
Properties:
Example// Create a picture form with the specific picture form properties: var oPictureFormPrBase = {"scaleFlag": "tooBig", "lockAspectRatio": true, "respectBorders": false, "shiftX": 50, "shiftY": 50}; var oPictureForm = Api.CreatePictureForm(oPictureFormPrBase); PositiveFixedAngle60000th of a degree (5400000 = 90 degrees). Type:
Example// The resulting gradient direction angle is 90 degrees: var oFill = Api.CreateLinearGradientFill([oGs1, oGs2], 5400000); PositivePercentageThe 1000th of a percent (100000 = 100%). Type:
Example// The resulting gradient stop position is 100%: var oGs2 = Api.CreateGradientStop(Api.CreateRGBColor(255, 164, 101), 100000); PresetColorThe available preset color names. Type:
Example// Create a scheme color using the 'lightYellow' color preset: var oSchemeColor = Api.CreatePresetColor("lightYellow"); ptA point. Type:
Example// The paragraph will have a single 3 point wide green bottom border with a 1 point offset from the bottom paragraph edge: oParaPr.SetBottomBorder("single", 24, 1, 0, 255, 0); pt_8Eighths of a point (24 eighths of a point = 3 points). Type:
Example// The paragraph will have a single 6 point wide green bottom border with a zero offset from the bottom paragraph edge: oParaPr.SetBottomBorder("single", 48, 0, 0, 255, 0); RelFromHThe possible values for the base which the relative horizontal positioning of an object will be calculated from. Type:
Example// The created drawing will be centered horizontally relative to the page width: oDrawing.SetHorAlign("page", "center"); RelFromVThe possible values for the base which the relative vertical positioning of an object will be calculated from. Type:
Example// The created drawing will be centered vertically relative to the page height: oDrawing.SetVerAlign("page", "center"); ReviewReportReport on all review changes. This is a dictionary where the keys are usernames. Type:
Example// Report on all review changes: var oReviewRecord = { "John Smith" : [{Type: "TextRem", Value: "Hello, Mark!", Date: 1679941734161}, {Type: "TextAdd", Value: "Dear Mr. Pottato.", Date: 1679941736189}], "Mark Pottato" : [{Type: "ParaRem", Date: 1679941755942}, {Type: "TextPr", Date: 1679941757832}] } ReviewReportRecordRecord of one review change. Type:
Properties:
Example// Report on all review changes that contains two review records for every user: var oReviewReportRecord1 = {Type: "TextRem", Value: "Hello, Mark!", Date: 1679941734161}; var oReviewReportRecord2 = {Type: "TextAdd", Value: "Dear Mr. Pottato.", Date: 1679941736189}; var oReviewReportRecord3 = {Type: "ParaRem", Date: 1679941755942}; var oReviewReportRecord4 = {Type: "TextPr", Date: 1679941757832}; var oReviewRecord = { "John Smith" : [oReviewReportRecord1, oReviewReportRecord2], "Mark Pottato" : [oReviewReportRecord3, oReviewReportRecord4] } ReviewReportRecordTypeReview record type. Type:
Example// Report on all review changes that contains review records of four different types: "TextRem" - removing text, "TextAdd" - adding text, "ParaRem" - removing a paragraph, "TextPr" - changing text properties: var oReviewReportRecord1 = {Type: "TextRem", Value: "Hello, Mark!", Date: 1679941734161}; var oReviewReportRecord2 = {Type: "TextAdd", Value: "Dear Mr. Pottato.", Date: 1679941736189}; var oReviewReportRecord3 = {Type: "ParaRem", Date: 1679941755942}; var oReviewReportRecord4 = {Type: "TextPr", Date: 1679941757832}; var oReviewRecord = { "John Smith" : [oReviewReportRecord1, oReviewReportRecord2], "Mark Pottato" : [oReviewReportRecord3, oReviewReportRecord4] } ScaleFlagThe condition to scale an image in the picture form. Type:
Example// Set the scaling condition when the current picture form is scaled if it is too big: oPictureForm.SetScaleFlag("tooBig"); SchemeColorIdThe available color scheme identifiers. Type:
Example// Create a scheme color with the 'accent2' identifier: var oSchemeColor = Api.CreateSchemeColor("accent2"); SdtLockThe lock type of the content control. Type:
Example// Set the "sdtContentLocked" lock to the current inline text content control which means that the content cannot be edited and the container cannot be deleted: oInlineLvlSdt.SetLock("sdtContentLocked"); ShapeTypeThis type specifies the preset shape geometry that will be used for a shape. Type:
Example// Create a shape using the 'diamond' preset: var oDrawing = Api.CreateShape("diamond", 100 * 36000, 100 * 36000, oFill, oStroke); ShdTypeA shade type which can be added to the document element. Type:
Example// Add a green shadow to the table: oTablePr.SetShd("clear", 0, 255, 0, false); SortHeaderSpecifies whether the first row of the sort range contains the header information. Type:
Example// Specify that the first row contains header information: oWorksheet.GetRange("A1:C5").SetSort("A1:A5", "xlAscending", "B1:B5", "xlDescending", "C1:C5", "xlAscending", "xlYes", "xlSortColumns"); SortOrderSpecifies the sort order. Type:
Example// Specify that the sort order for the values specified in "A1:A5" is ascending: oWorksheet.GetRange("A1:C5").SetSort("A1:A5", "xlAscending", "B1:B5", "xlDescending", "C1:C5", "xlAscending", "xlYes", "xlSortColumns"); SortOrientationSpecifies if the sort should be by row or column. Type:
Example// Specify that the sort should be by column: oWorksheet.GetRange("A1:C5").SetSort("A1:A5", "xlAscending", "B1:B5", "xlDescending", "C1:C5", "xlAscending", "xlYes", "xlSortColumns"); StyleTypeThe style type used for the document element. Type:
Example// Assign the default document paragraph style to the 'oNormalStyle' variable: var oNormalStyle = oDocument.GetDefaultStyle("paragraph"); TabJcTypes of custom tab. Type:
Example// Set tab positions at 50, 75 and 150 points with the text aligned center, left and right at each tab stop accordingly: oParaPr.SetTabs([1000, 1500, 3000], ["center", "left", "right"]); TableStyleOverrideTypeThis simple type specifies possible values for the table sections to which the current conditional formatting properties will be applied when this selected table style is used.
Type:
Example// Apply the created style (set shadow) to the top left cell of the table: oTableStyle.GetConditionalTableStyle("topLeftCell").GetTableCellPr().SetShd("clear", 255, 0, 0); TableWidthThe possible values for the units of the width property are defined by a specific table or table cell width property.
Type:
Example// Set the width of the table cell equal to 100 points (2000 twips): oTableCell.SetWidth("twips", 2000); TextFormInsertPrProperties for inserting a text field. Type:Example// Insert a text box with the specified text box properties over the selected text: var oTextFormInsertPr = {"key": "Personal information", "tip": "Enter your first name", "required": true, "placeholder": "Name", "comb": true, "maxCharacters": 10, "cellWidth": 3, "multiLine": false, "autoFit": false, "placeholderFromSelection": true, "keepSelectedTextInForm": false}; oDocument.InsertTextForm(oTextFormInsertPr); TextFormPrText field properties. Type:Example// Create a text form with the common and specific text form properties: var oTextFormPr = {"key": "Personal information", "tip": "Enter your first name", "required": true, "placeholder": "First name", "comb": true, "maxCharacters": 10, "cellWidth": 3, "multiLine": false, "autoFit": false}; var oTextForm = Api.CreateTextForm(oTextFormPr); TextFormPrBaseSpecific text field properties. Type:
Properties:
Example// Create a text form with the specific text form properties: var oTextFormPrBase = {"comb": true, "maxCharacters": 10, "cellWidth": 3, "multiLine": false, "autoFit": false}; var oTextForm = Api.CreateTextForm(oTextFormPrBase); TextTransformText transform type. Type:
Example// Create a Text Art object with the "textArchUp" text transform type: var oTextArt = Api.CreateWordArt(oTextPr, "onlyoffice", "textArchUp", oFill, oStroke, 0, 150 * 36000, 50 * 36000); TickLabelPositionPossible values for the position of chart tick labels (either horizontal or vertical).
Type:
Example// Set the position of the vertical tick labels next to the main vertical label: oChart.SetVertAxisTickLabelPosition("nextTo"); TickMarkThe type of tick mark appearance. Type:
Example// Specify the "cross" major tick mark type for the vertical axis: oChart.SetVertAxisMajorTickMark("cross"); TocBuildFromPrTable of contents properties which specify whether to generate the table of contents from the outline levels or the specified styles. Type:
Properties:
Example// Add a table of contents which is generated from 9 outline levels to the document: var oTocBuildFromPr = {"OutlineLvls": 9}; var oTocPr = {"ShowPageNums": true, "RightAlgn": true, "LeaderType": "dot", "FormatAsLinks": true, "BuildFrom": oTocBuildFromPr, "TocStyle": "standard"}; oDocument.AddTableOfContents(oTocPr); TocLeaderPossible values for the table of contents leader:
Type:
Example// Add a table of contents with the dot leader to the document: var sTocLeader = "dot"; var oTocPr = {"ShowPageNums": true, "RightAlgn": true, "LeaderType": sTocLeader, "FormatAsLinks": true, "BuildFrom": {"OutlineLvls": 9}, "TocStyle": "standard"}; oDocument.AddTableOfContents(oTocPr); TocPrTable of contents properties. Type:
Properties:
Example// Add a table of contents with the specified properties to the document: var oTocPr = {"ShowPageNums": true, "RightAlgn": true, "LeaderType": "dot", "FormatAsLinks": true, "BuildFrom": {"OutlineLvls": 9}, "TocStyle": "standard"}; oDocument.AddTableOfContents(oTocPr); TocStylePossible values for the table of contents style. Type:
Example// Add a table of contents of the standard style to the document: var sTocStyle = "standard"; var oTocPr = {"ShowPageNums": true, "RightAlgn": true, "LeaderType": "dot", "FormatAsLinks": true, "BuildFrom": {"OutlineLvls": 9}, "TocStyle": sTocStyle}; oDocument.AddTableOfContents(oTocPr); TocStyleLvlTable of contents style levels. Type:
Properties:
Example// Add a table of contents which is generated from the specified styles to the document: var aTocStyleLvl = [{Name: "Heading 1", Lvl: 2}, {Name: "Heading 2", Lvl: 3}]; var oTocPr = {"ShowPageNums": true, "RightAlgn": true, "LeaderType": "dot", "FormatAsLinks": true, "BuildFrom": {"StylesLvls": aTocStyleLvl}, "TocStyle": "standard"}; oDocument.AddTableOfContents(oTocPr); TofPrTable of figures properties. Type:
Properties:
Example// Add a table of figures with the specified properties to the document: var oTofPr = {"ShowPageNums": true, "RightAlgn": true, "LeaderType": "dot", "FormatAsLinks": true, "BuildFrom": "Figure", "LabelNumber": true, "TofStyle": "distinctive"}; oDocument.AddTableOfFigures(oTofPr); TofStylePossible values for the table of figures style. Type:
Example// Add a table of figures of the distinctive style to the document: var sTofStyle = "distinctive"; var oTofPr = {"ShowPageNums": true, "RightAlgn": true, "LeaderType": "dot", "FormatAsLinks": true, "BuildFrom": "Figure", "LabelNumber": true, "TofStyle": sTofStyle}; oDocument.AddTableOfFigures(oTofPr); twipsTwentieths of a point (equivalent to 1/1440th of an inch). Type:
Example// Set the distance between columns equal to 36 points: oParagraph.SetEqualColumns(2, 720); VerticalTextAlignThe available text vertical alignment (used to align text in a shape with a placement for text inside it). Type:
Example// The inner text for the created shape will be added aligned vertically closer to the shape upper part: oDrawing.SetVerticalTextAlign("top"); XlFindLookInSearch data type (formulas or values). Type:
Example// Specify that the values will be searched in the current range: var oSearchRange = oRange.Find("200", "B1", "xlValues", "xlWhole", "xlByColumns", "xlNext", true); XlLookAtSpecifies whether the whole search text or any part of the search text is matched. Type:
Example// Specify that the whole text match will be searched in the current range: var oSearchRange = oRange.Find("200", "B1", "xlValues", "xlWhole", "xlByColumns", "xlNext", true); XlSearchDirectionRange search direction - next match or previous match. Type:
Example// Specify that the next text match will be searched in the current range: var oSearchRange = oRange.Find("200", "B1", "xlValues", "xlWhole", "xlByColumns", "xlNext", true); XlSearchOrderRange search order - by rows or by columns. Type:
Example// Specify that the values will be searched by columns in the current range: var oSearchRange = oRange.Find("200", "B1", "xlValues", "xlWhole", "xlByColumns", "xlNext", true); XlUnderlineStyleUnderline type. Type:
Example// Specify that the single underlining is applied to the current font: oFont.SetUnderline("xlUnderlineStyleSingle"); |