ONLYOFFICE / doc-builder-testing

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[7.2] Add tests to convert objects to json through the builder `#58126`

askonev opened this issue · comments

Simple builder script

builder.CreateFile("docx");
var oDocument = Api.GetDocument();
var oParagraph = oDocument.GetElement(0);
    oParagraph.AddText("Sample");
GlobalVariable["paragraph"] = oParagraph.ToJSON(false, false);
builder.CloseFile();

///////////////////////////

builder.CreateFile("docx");
var oDocument = Api.GetDocument();
var oConvertParagraph = Api.FromJSON(GlobalVariable["paragraph"]);
    oDocument.Push(oConvertParagraph);
builder.SaveFile("docx", "Sample.docx");
builder.CloseFile();