How to insert Text from Web Page

I see macros can insert text to editor , but how can I insert text from my app ? (not use macros but user can see it right now)

Command service /meta will support insert text ?

Please describe the scenario of what you are trying to achieve in more details. Are you using just the Document Builder or writing a plugin?

Yes I Use Plugin , But don’t know how can I send param from documentEditor to plugin.

window.onload = () => {
    uuid = sessionStorage.getItem('template.uuid')

can run


window.Asc.plugin.init = function(){
    uuid = sessionStorage.getItem('template.uuid')

not run

I would ask you once again to provide a detailed scenario of what you are trying to achieve.

I want use in a online document edit system , use my database data insert to word(doc) file, and show the file to user.

You can use content controls to insert data from external sources to your document. Content controls can be created with a plugin.
Here are our plugin examples that demonstrate how to work with content controls:

Plugin documentation: ONLYOFFICE Api Documentation - Overview

(function(window, undefined){
window.Asc.plugin.init = function(text)
var comment = document.getElementById(“textareaIDComment”);
var author = document.getElementById(“textareaIDAuthor”);
document.getElementById(“buttonIDAddComment”).onclick = function() {
window.Asc.plugin.button = function(id)
this.executeCommand(“close”, “”);
})(window, undefined);

this program can use plugin add comment to document , but I want query data from REST Service but query param eg. key or uuid can not set to the plugin program.
the plugin only use index.html element , can not use page localStorage or sessionStorage.

eg. : /sdkjs-plugins/cbr/cbr.js

(function (window, undefined) {
var apiCurrency = ‘’;
var access_key = ‘abd009701042b282bda944c660c90fb2’;
function formatDate(date) {
var month = ‘’ + (date.getMonth() + 1);
var day = ‘’ + date.getDate();
var year = date.getFullYear();
if (month.length < 2) {
month = ‘0’ + month;
if (day.length < 2) {
day = ‘0’ + day;
return [year, month, day].join(’-’);

I want “apiCurrency” can set by user , add “access_key” can read from users page localStorage.

I don’t understand your scenario and without a proper description I won’t be able to assist.

Sorry to description the question.

  1. I can not find the plugin example match I trying to achieve.
  2. I try to use plugin get data from my http server and use the data insert into Doc file.
  3. my http server IP address need configurable.
  4. how can I access my variable (for example: http server IP address, POST to http server variable) from the plugin via DocumentEditor or Application WebPage.
  5. Can I use Chinese ?

Communication on this forum is on English only. As I mentioned, the only way to import external data to a document via plugin is to use the content control functionality. Please install the example plugins I mentioned previously and see how it works.

thanks! I try it.