Api

class Api

Description

Base class

Instance Methods

GetVersion(): string

Returns the editor version.

AddOleObject(data)

Adds an OLE object to the current document position.

EditOleObject(data)

Edits an OLE object in the document.

GetSelectedOleObjects(): OLEProperties[]

Returns an array of the selected OLE objects.

GetFontList(): FontInfo[]

Returns the fonts list.

InputText(text, textReplace)

Inserts text into the document.

PasteHtml(htmlText)

Pastes text in the HTML format into the document.

PasteText(text)

Pastes text into the document.

GetMacros(): Macros

Returns the document macros.

SetMacros(data)

Sets macros to the document.

GetVBAMacros(): string | "null"

Returns all VBA macros from the document.

StartAction(type, description)

Specifies the start action for long operations.

EndAction(type, description, status)

Specifies the end action for long operations.

OnEncryption(obj, obj.type, obj.password, obj.data, obj.check, obj.docinfo, obj.hash, obj.error)

Encrypts the document.

SetProperties(obj, obj.copyoutenabled, obj.hideContentControlTrack, obj.watermark_on_draw, obj.disableAutostartMacros, obj.fillForms)

Sets the properties to the document.

SetPluginsOptions(options)

Set options for all plugins.

ShowInputHelper(guid, w, h, isKeyboardTake)

Shows the input helper.

UnShowInputHelper(guid, isclear)

Unshows the input helper.

CoAuthoringChatSendMessage(sText)

Sends a message to the co-authoring chat.

GetSelectionType(): SelectionType

Returns the type of the current selection.

ConvertDocument(sConvertType, bHtmlHeadings, bBase64img, bDemoteHeadings, bRenderHTMLTags): string

Converts a document to Markdown or HTML text.

GetSelectedText(prop, prop.NewLine, prop.NewLineParagraph, prop.Numbering, prop.Math, prop.TableCellSeparator, prop.TableRowSeparator, prop.ParaSeparator, prop.TabSymbol, prop.NewLineSeparator): string

Returns the selected text from the document.

ReplaceTextSmart(arrString, sParaTab, sParaNewLine): boolean

Replaces each paragraph (or text in cell) in the select with the corresponding text from an array of strings.

GetFileToDownload(format): string

Returns the current file to download in the specified format.

GetImageDataFromSelection(): ImageData

Returns the image data from the first of the selected drawings.

PutImageDataToSelection(oImageData)

Replaces the first selected drawing with the image specified in the parameters.

GetInstalledPlugins(): PluginData[]

Returns all the installed plugins.

RemovePlugin(guid, backup): object

Removes a plugin with the specified GUID.

InstallPlugin(config): object

Installs a plugin by the URL to the plugin config.

UpdatePlugin(config): object

Updates a plugin by the URL to the plugin config.

InstallDeveloperPlugin(configUrl): boolean

Installs a plugin by the URL to the plugin config.

ShowButton(id, bShow, align)

Shows or hides buttons in the header.

OnDropEvent(obj, obj.type, obj.x, obj.y, obj.html, obj.text)

Implements the external drag&drop emulation.

GetDocumentLang(): string

Returns the document language.

AddContextMenuItem(items)

Adds an item to the context menu.

UpdateContextMenuItem(items)

Updates an item in the context menu with the specified items.

AddToolbarMenuItem(items)

Adds an item to the toolbar menu.

ShowWindow(frameId, variation)

Shows the plugin modal window.

ActivateWindow(frameId)

Activates (moves forward) the plugin window/panel.

CloseWindow(frameId)

Closes the plugin modal window.

SendToWindow(windowID, name, data)

Sends a message to the plugin modal window.

ResizeWindow(frameId, size, minSize, maxSize)

Resizes the plugin modal window.

MouseUpWindow(frameId, x, y)

Sends an event to the plugin when the mouse button is released inside the plugin iframe.

MouseMoveWindow(frameId, x, y)

Sends an event to the plugin when the mouse button is moved inside the plugin iframe.

Get Help

  • If you have any questions about ONLYOFFICE Docs, try the FAQ section first.
  • You can request a feature or report a bug by posting an issue on GitHub.
  • You can also ask our developers on ONLYOFFICE forum (registration required).