mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-04-07 13:55:33 +08:00
Create test onescript
This commit is contained in:
@ -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();
|
||||
Reference in New Issue
Block a user