How to request a network interface in a.DocBuilder script
builder.CreateFile("docx");
var oDocument = Api.GetDocument();
var oParagraph, oRun;
function request(url,method,callback) {
let xhr = new XMLHttpRequest();
xhr.open(method,url,true);
xhr.onreadystatechange = function () {
if (xhr.readyState === 4 && xhr.status === 200) {
callback(xhr.responseText);
}
};
xhr.send(null);
}
request('get', 'https://example.com/xxx.do', function (res) {
console.log(res);
})
oParagraph = Api.CreateParagraph();
oParagraph.AddText("111");
oDocument.Push(oParagraph);
builder.SaveFile("docx", "SampleText.docx");
builder.CloseFile();
Execution prompt:Result without file
Can you see what the problem is, please