-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
30 changed files
with
303 additions
and
121 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
from python.docbuilder import builder | ||
builder.CreateFile("docx") | ||
context = builder.GetContext() | ||
scope = context.CreateScope() | ||
globalObj = context.GetGlobal() | ||
builder.SaveFile("docx", "BaseExample.docx") | ||
builder.SaveFile("docx", "GetContext.docx") | ||
builder.CloseFile() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from python.docbuilder import builder | ||
builder.CreateFile("docx") | ||
builder.SaveFile("docx", "SaveFile.docx") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
from python.docbuilder import builder | ||
builder.CreateFile("docx") | ||
|
||
context = builder.GetContext() | ||
scope = context.CreateScope() | ||
globalObj = context.GetGlobal() | ||
api = globalObj["Api"] | ||
|
||
document = api.Call("GetDocument") | ||
paragraph = document.Call("GetElement", 0) | ||
paragraph.Call("AddText", "Without CreateScope script doesn't works") | ||
|
||
builder.SaveFile("docx", "CreateScope.docx") | ||
builder.CloseFile() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
from python.docbuilder import builder | ||
builder.CreateFile("docx") | ||
|
||
context = builder.GetContext() | ||
scope = context.CreateScope() | ||
globalObj = context.GetGlobal() | ||
api = globalObj["Api"] | ||
|
||
document = api.Call("GetDocument") | ||
paragraph = document.Call("GetElement", 0) | ||
paragraph.Call("AddText", "If this paragraph is here, GetGlobal works") | ||
|
||
builder.SaveFile("docx", "GetGlobal.docx") | ||
builder.CloseFile() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
from python.docbuilder import builder | ||
builder.CreateFile("docx") | ||
|
||
context = builder.GetContext() | ||
scope = context.CreateScope() | ||
globalObj = context.GetGlobal() | ||
api = globalObj["Api"] | ||
|
||
document = api.Call("GetDocument") | ||
paragraph = document.Call("GetElement", 0) | ||
scope.Close() | ||
paragraph.Call("AddText", "Without created scope script doesn't works") | ||
|
||
builder.SaveFile("docx", "Close.docx") | ||
builder.CloseFile() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
from python.docbuilder import builder | ||
builder.CreateFile("docx") | ||
|
||
context = builder.GetContext() | ||
scope = context.CreateScope() | ||
globalObj = context.GetGlobal() | ||
api = globalObj["Api"] | ||
|
||
document = api.Call("GetDocument") | ||
paragraph = document.Call("GetElement", 0) | ||
image = api.Call("CreateImage", | ||
"https://api.onlyoffice.com/content/img/docbuilder/examples/coordinate_aspects.png", | ||
60 * 36000, 35 * 36000) | ||
paragraph.Call("AddDrawing", image) | ||
paragraph.Call("AddText", f"Width is double = {image.Call("GetWidth").IsDouble()}") | ||
paragraph.Call("AddLineBreak") | ||
paragraph.Call("AddText", f"LockValue is double = {image.Call("GetLockValue").IsDouble()}") | ||
|
||
builder.SaveFile("docx", "IsDouble.docx") | ||
builder.CloseFile() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
from python.docbuilder import builder | ||
builder.CreateFile("docx") | ||
|
||
context = builder.GetContext() | ||
scope = context.CreateScope() | ||
globalObj = context.GetGlobal() | ||
api = globalObj["Api"] | ||
|
||
document = api.Call("GetDocument") | ||
paragraph = document.Call("GetElement", 0) | ||
wrong_call = document.Call("GetElmnt", 0) | ||
paragraph.Call("AddText", f"Right call is empty = {paragraph.IsEmpty()}") | ||
paragraph.Call("AddLineBreak") | ||
paragraph.Call("AddText", f"Wrong call is empty = {wrong_call.IsEmpty()}") | ||
|
||
builder.SaveFile("docx", "IsEmpty.docx") | ||
builder.CloseFile() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
from python.docbuilder import builder | ||
builder.CreateFile("docx") | ||
|
||
context = builder.GetContext() | ||
scope = context.CreateScope() | ||
globalObj = context.GetGlobal() | ||
api = globalObj["Api"] | ||
obj = globalObj['Object'] | ||
|
||
document = api.Call("GetDocument") | ||
paragraph = document.Call("GetElement", 0) | ||
paragraph.Call("AddText", f'globalObj["Api"] is undefined = {api.IsFunction()}') | ||
paragraph.Call("AddLineBreak") | ||
paragraph.Call("AddText", f'globalObj["Object"] is undefined = {obj.IsFunction()}') | ||
|
||
builder.SaveFile("docx", "IsFunction.docx") | ||
builder.CloseFile() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
from python.docbuilder import builder | ||
builder.CreateFile("docx") | ||
|
||
context = builder.GetContext() | ||
scope = context.CreateScope() | ||
globalObj = context.GetGlobal() | ||
api = globalObj["Api"] | ||
|
||
document = api.Call("GetDocument") | ||
content = document.Call("GetContent") | ||
count = document.Call("GetElementsCount") | ||
paragraph = document.Call("GetElement", 0) | ||
paragraph.Call("AddText", f"Content is int = {content.IsInt()}") | ||
paragraph.Call("AddLineBreak") | ||
paragraph.Call("AddText", f"ElementsCount is int = {count.IsInt()}") | ||
|
||
builder.SaveFile("docx", "IsInt.docx") | ||
builder.CloseFile() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
from python.docbuilder import builder | ||
builder.CreateFile("docx") | ||
|
||
context = builder.GetContext() | ||
scope = context.CreateScope() | ||
globalObj = context.GetGlobal() | ||
api = globalObj["Api"] | ||
|
||
document = api.Call("GetDocument") | ||
paragraph = document.Call("GetElement", 0) | ||
image = api.Call("CreateImage", | ||
"https://api.onlyoffice.com/content/img/docbuilder/examples/coordinate_aspects.png", | ||
60 * 36000, 35 * 36000) | ||
paragraph.Call("AddDrawing", image) | ||
images = paragraph.Call("GetAllImages") | ||
paragraph.Call("AddText", f"Images[0] is undefined = {images[0].IsUndefined()}") | ||
paragraph.Call("AddLineBreak") | ||
paragraph.Call("AddText", f"Images[1] is undefined = {images[1].IsUndefined()}") | ||
|
||
builder.SaveFile("docx", "IsUndefined.docx") | ||
builder.CloseFile() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
from python.docbuilder import builder | ||
builder.CreateFile("docx") | ||
|
||
context = builder.GetContext() | ||
scope = context.CreateScope() | ||
globalObj = context.GetGlobal() | ||
api = globalObj["Api"] | ||
|
||
document = api.Call("GetDocument") | ||
paragraph = document.Call("GetElement", 0) | ||
image = api.Call("CreateImage", | ||
"https://api.onlyoffice.com/content/img/docbuilder/examples/coordinate_aspects.png", | ||
60 * 36000, 35 * 36000) | ||
paragraph.Call("AddDrawing", image) | ||
paragraph.Call("AddText", f"Width = {image.Call("GetWidth").ToDouble()}") | ||
|
||
builder.SaveFile("docx", "ToDouble.docx") | ||
builder.CloseFile() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
from python.docbuilder import builder | ||
builder.CreateFile("docx") | ||
|
||
context = builder.GetContext() | ||
scope = context.CreateScope() | ||
globalObj = context.GetGlobal() | ||
api = globalObj["Api"] | ||
|
||
document = api.Call("GetDocument") | ||
content = document.Call("GetContent") | ||
count = document.Call("GetElementsCount") | ||
paragraph = document.Call("GetElement", 0) | ||
paragraph.Call("AddText", f"ElementsCount = {count.ToInt()}") | ||
|
||
builder.SaveFile("docx", "ToInt.docx") | ||
builder.CloseFile() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.