Skip to main content

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

For JS, this method is not used. This method is not available in C++ (use RunTextA or RunTextW instead).

Syntax

def RunText(self, commands: str) -> bool

Parameters

NameTypeDescription
commandsstrThe 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

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();")