RunText
Runs all the commands for the document creation using a single command. Compared to CDocBuilder.ExecuteCommand where only one command at a time is allowed, CDocBuilder.RunText makes it possible to enter all the commands for the document creation at once.
note
Syntax
- Python
- COM
- Java
- .Net
def RunText(self, commands: str) -> bool
HRESULT RunText([in] BSTR commands, [out, retval] VARIANT_BOOL* result);
boolean runText(String commands);
bool RunText(String^ sCommands);
Parameters
- Python
- COM
- Java
- .Net
| Name | Type | Description |
|---|---|---|
| commands | str | The commands which will be used to create the document file (the escape character must be used when the command contains quotation symbols). All the commands containing builder. are line separated, i.e. you cannot write them in one line, each command must start with its own line. |
| Name | Type | Description |
|---|---|---|
| commands | BSTR | The commands which will be used to create the document file (the escape character must be used when the command contains quotation symbols). All the commands containing builder. are line separated, i.e. you cannot write them in one line, each command must start with its own line. |
| result | VARIANT_BOOL* | Specifies if the operation is successful or not. |
| Name | Type | Description |
|---|---|---|
| commands | String | The commands which will be used to create the document file (the escape character must be used when the command contains quotation symbols). All the commands containing builder. are line separated, i.e. you cannot write them in one line, each command must start with its own line. |
| Name | Type | Description |
|---|---|---|
| sCommands | String^ | The commands which will be used to create the document file (the escape character must be used when the command contains quotation symbols). All the commands containing builder. are line separated, i.e. you cannot write them in one line, each command must start with its own line. |
Example
- Python
- COM
- Java
- .Net
import docbuilder
builder = docbuilder.CDocBuilder()
builder.RunText("builder.SetTmpFolder(\"DocBuilderTemp\");\n\
builder.CreateFile(\"docx\");\n\
var oDocument = Api.GetDocument();var oParagraph = oDocument.GetElement(0);oParagraph.SetJc(\"center\");oParagraph.AddText(\"Center\");\n\
builder.SaveFile(\"pdf\", \"images.pdf\");\n\
builder.CloseFile();")
CoInitialize(NULL);
IONLYOFFICEDocBuilder* oBuilder = NULL;
VARIANT_BOOL b;
oBuilder->RunText("builder.SetTmpFolder(\"DocBuilderTemp\");\n\
builder.CreateFile(\"docx\");\n\
var oDocument = Api.GetDocument();var oParagraph = oDocument.GetElement(0);oParagraph.SetJc(\"center\");oParagraph.AddText(\"Center\");\n\
builder.SaveFile(\"pdf\", \"images.pdf\");\n\
builder.CloseFile();", &b);
oBuilder->Dispose();
CDocBuilder.initialize("");
CDocBuilder builder = new CDocBuilder();
builder.runText("builder.SetTmpFolder(\"DocBuilderTemp\");\n\
builder.CreateFile(\"docx\");\n\
var oDocument = Api.GetDocument();var oParagraph = oDocument.GetElement(0);oParagraph.SetJc(\"center\");oParagraph.AddText(\"Center\");\n\
builder.SaveFile(\"pdf\", \"images.pdf\");\n\
builder.CloseFile();");
CDocBuilder.dispose();
string workDirectory = "C:/Program Files/ONLYOFFICE/documentBuilder";
CDocBuilder.Initialize(workDirectory);
CDocBuilder oBuilder = new CDocBuilder();
oBuilder.RunText("builder.SetTmpFolder(\"DocBuilderTemp\");\n\
builder.CreateFile(\"docx\");\n\
var oDocument = Api.GetDocument();var oParagraph = oDocument.GetElement(0);oParagraph.SetJc(\"center\");oParagraph.AddText(\"Center\");\n\
builder.SaveFile(\"pdf\", \"images.pdf\");\n\
builder.CloseFile();");
CDocBuilder.Destroy();