Open PaSen-pzk opened 2 years ago
Hi, I think we need both those files to correctly diagnose the situation "2022072-10000-81acb5fcd08244e3926c891263cfe168.docx" "2022072-10000-99c8b7f2ef844e97b6410eee0b0618c2.docx"
Hello @PaSen-pzk ! You are not using GlobalVariable correctly.
Example of correct usage:
builder.OpenFile("2022072-10000-81acb5fcd08244e3926c891263cfe168.docx");
var oDocument = Api.GetDocument();
GlobalVariable["CommentsReport"] = oDocument.GetElement(0).GetText();
builder.CloseFile();
builder.OpenFile("2022072-10000-99c8b7f2ef844e97b6410eee0b0618c2.docx");
var oCommentsReport = GlobalVariable["CommentsReport"];
var oDocument = Api.GetDocument();
var oParagraph = Api.CreateParagraph();
oParagraph.InsertParagraph(oCommentsReport, "after", true);
builder.SaveFile("docx", "Result.docx");
builder.CloseFile();
你好@PaSen-pzk! 您没有正确使用 GlobalVariable。
正确用法示例:
builder.OpenFile("2022072-10000-81acb5fcd08244e3926c891263cfe168.docx"); var oDocument = Api.GetDocument(); GlobalVariable["CommentsReport"] = oDocument.GetElement(0).GetText(); builder.CloseFile(); builder.OpenFile("2022072-10000-99c8b7f2ef844e97b6410eee0b0618c2.docx"); var oCommentsReport = GlobalVariable["CommentsReport"]; var oDocument = Api.GetDocument(); var oParagraph = Api.CreateParagraph(); oParagraph.InsertParagraph(oCommentsReport, "after", true); builder.SaveFile("docx", "Result.docx"); builder.CloseFile();
In this case, there is no guarantee that the merged content format is consistent with the source file. In the way you provided, I tried to get the text format, that is, apitextpr, and add it to the global variable, but the function contained in this apitextpr object cannot be serialized, so it is not available.
你好@PaSen-pzk! 您没有正确使用 GlobalVariable。 正确用法示例:
builder.OpenFile("2022072-10000-81acb5fcd08244e3926c891263cfe168.docx"); var oDocument = Api.GetDocument(); GlobalVariable["CommentsReport"] = oDocument.GetElement(0).GetText(); builder.CloseFile(); builder.OpenFile("2022072-10000-99c8b7f2ef844e97b6410eee0b0618c2.docx"); var oCommentsReport = GlobalVariable["CommentsReport"]; var oDocument = Api.GetDocument(); var oParagraph = Api.CreateParagraph(); oParagraph.InsertParagraph(oCommentsReport, "after", true); builder.SaveFile("docx", "Result.docx"); builder.CloseFile();
In this case, there is no guarantee that the merged content format is consistent with the source file. In the way you provided, I tried to get the text format, that is, apitextpr, and add it to the global variable, but the function contained in this apitextpr object cannot be serialized, so it is not available.
This is a bug. Issue 58126 in our private issue tracker.
Integrate ONLYOFFICE Document Builder into my application on Node.js. Using globalvariable method to create paragraph object will cause errors. Steps to reproduce the problem: Exception Info:
Script example:
Execution mode: Run the above script with the executable file of docbuilder under the onlyoffice installation directory. DocumentBuilder version: Version: 7.1.1 Installation method: Download and unpack on Windows . Operating system: Windows11