const docInstance = getOnlyOfficeInstance("template_editor_renderer")
const connector = createConnector(docInstance)
connector.callCommand(() => {
try {
// Get the document instance
const oDocument = Api.GetDocument()
} catch (err) {
console.log("Error in command execution - SS", err)
}
})
Hello @lovefrompal,
For us to be able to properly assist, we need you to provide a more detailed question.
Please elaborate on the scenario. What are you trying to achieve?
You can use this event Events and add your own function to it.
For example, you can try executing this GetFileHTML - ONLYOFFICE Api Documentation via connector when the event is fired. Please let me know if this helps.
Hi @Carl It Works. Is there a way to get the selected content as a html?
We have GetSelectedText mehtod and return selected content as a string
@Carl How do i get the selected content in html on the fly instead of getting it from box. Kindly share the code example of that
Hello @lovefrompal,
Unfortunately, at the moment it is possible only in the plugin. If you initialize the plugin with
"initDataType": "html",
"initOnSelectionChanged": true,
https://api.onlyoffice.com/docs/plugin-and-macros/structure/manifest/#variationsinitdatatype
you will receive selected parts of the document in html format in the init event.
https://api.onlyoffice.com/docs/plugin-and-macros/interacting-with-editors/methods/common-api/plugin/init/
We are planning to add the required method to the Automation API in Document Server 8.3 (~1 month).