How to insert text into onlyoffice webword?

182 views Asked by At

I want to insert text into word, but I can not find the api;

let docEditor = new DocsAPI.DocEditor("placeholder", config);

docEditor.insertText('simple text') // this is I want to do, but insertText is undefine
1

There are 1 answers

0
probelover On

You can read this url https://api.onlyoffice.com/docbuilder/textdocumentapi
sample code:

builder.CreateFile("docx");
var oDocument = Api.GetDocument();
var oParagraph = oDocument.GetElement(0);
oParagraph.AddText("This is just a sample text. Nothing special.");
builder.SaveFile("docx", "AddText.docx");
builder.CloseFile();