参考:
使用 ONLYOFFICE 宏快速删除多余空格_ONLYOFFICE的技术博客_51CTO博客
ONLYOFFICE Api Documentation - InsertContent
插入文本
var connector = docEditor.createConnector()
connector.callCommand(function() {
var oDocument = Api.GetDocument();
var oParagraph = Api.CreateParagraph();
oParagraph.AddText("放大:{范德}萨");
oDocument.InsertContent([oParagraph],{ "KeepTextOnly": true });
}, function() {
console.log("callback command");
});
callCommand函数设计的隔离性非常好,Api在函数里面是可以访问到的,在外面访问不到
InsertContent 不输入第2个参数的时候,插入后会自动换行