Cloud Computing Insider Awards 2022: Vote for ONLYOFFICE
Vote for ONLYOFFICE

Can I print a text document using document builder?

I am using a script to create several text files. After saving the changes to each file, I need to print it in multiple copies. Is it possible to do this?
For example:

// I get data from the "xlsx" file
builder.OpenFile("MyData.xlsx");
var oSheet = Api.GetActiveSheet();
GlobalVariable["vg_a1"] = oSheet.GetRange("a1").GetText(); // name
GlobalVariable["vg_b1"] = oSheet.GetRange("b1").GetText(); // data
builder.CloseFile();

// creating the first file based on the template (file1.dotx) and  and data from "MyData.xlsx"
builder.OpenFile("file1.dotx");
var oDocument = Api.GetDocument();

v_findtext = GlobalVariable["vg_a1"];
v_replace = GlobalVariable["vg_b1"];
oDocument.SearchAndReplace({"searchString": v_findtext, "replaceString": v_replace});
builder.SaveFile("docx","./ResultFile1.docx");
// ---
// here I need to print 2 copies of this file
// ---
builder.CloseFile();

// creating the second file based on the template (file2.dotx) and data from "MyData.xlsx"
builder.OpenFile("file2.dotx");
var oDocument = Api.GetDocument();

v_findtext = GlobalVariable["vg_a1"];
v_replace = GlobalVariable["vg_b1"];
oDocument.SearchAndReplace({"searchString": v_findtext, "replaceString": v_replace});
builder.SaveFile("docx","./ResultFile2.docx");
// ---
// here I need to print 2 copies of this file
// ---
builder.CloseFile();

Hello @Alex2022
Sorry, there’s no way to do such actions (print) via Document Builder API.