Create test onescript

This commit is contained in:
Alexey
2022-11-01 13:03:36 +03:00
parent ed3a8f7916
commit a36e31ab0f

View File

@ -0,0 +1,28 @@
doctype = ".docx";
resultPath = "result.docx";
oBuilder = New COMObject("ONLYOFFICE.Builder");
oBuilder.Initialize();
oBuilder.CreateFile(doctype);
oContext = oBuilder.GetContext();
oScope = oContext.CreateScope();
oGlobal = oContext.GetGlobal();
// optional is not working
oApi = oGlobal.GetProperty("Api");
oDocument = oApi.Call("GetDocument",,,,,,);
oParagraph = oApi.Call("CreateParagraph",,,,,,);
oContent = oContext.CreateArray(1);
oParagraph.Call("SetSpacingAfter", 10, Ложь,,,,); // err?
oParagraph.Call("AddText", "Hello from COM -> OS!",,,,,);
oContent.Set(0, oParagraph);
oDocument.Call("InsertContent", oContent,,,,,);
oBuilder.SaveFile(doctype, resultPath);
oBuilder.CloseFile();
oBuilder.Dispose();