Can docbuilder use custom parameters?

I use Web Document Builder API to generate documentation, how to pass custom parameters.In the .docbuilder I use 【var sCompany = Argument[“company”];】 to receive parameters and the result is undefined.

Hello, there is no way to pass custom parameters to builder. All available methods are described in the documentation:
https://api.onlyoffice.com/docbuilder/basic

thanks for your answer。ONLYOFFICE Api Documentation - Web Document Builder API this method cannot pass parameters,I can use the following:

docbuilder.exe "--argument={\"company\":\"ONLYOFFICE\",\"product\":\"ONLYOFFICE Document Builder\",\"compatibility\":\"100%\"}" "path-to-file\sample_with_arguments.docbuilder"

I just wanted to check if the passing of arguments via API is on the roadmap for development? Thanks in advance, Dave

Hello @molloyda
Do you mean this method? ONLYOFFICE Api Documentation - ONLYOFFICE Document Builder integration API
If I misunderstood the situation, please provide us with details.

By the way, if you have commercial license, it’s better to contact us via https://onlyofficesupport.zendesk.com/ to get prompt replies.

Hi Alexandre,
We are calling docbuilder as a URL from an enterprise installation of OnlyOffice Docs running as a container.

We have been able to pass arguments locally to a command line ‘docbuilder.exe’ but are uncertain if it is possible to pass them via URL.

E.g. ONLYOFFICE Api Documentation - Web Document Builder API

It looks like you can only pass a previously constructed .docbuilder file but have no mechanism to pass a docbuilder file and separately arguments.

Just wanted to check if that functionality is on the roadmap (or if we’re missing something)

Many thanks,
Dave

Hello @molloyda
We need some time to check it out. I will come back to you as soon as possible.

Hello @molloyda
We are going to update our API guides and add a sample how to use arguments with web builder. At this very moment, probably this sample of request may be useful for you:
.docbulder

builder.CreateFile("docx");
    let oDoc = Api.GetDocument(0);
    let oPar = oDoc.GetElement(0);
        oPar.AddText(Argument["key"]);
        oPar.AddLineBreak();
        oPar.AddText(Argument["key2"]);
builder.SaveFile("docx", "simple.docx");
builder.CloseFile();

request

var body = {
    "payload": {
        "async": false,
        "url": buidler_script,
        "argument": { "key": "string", "key2": "string2" }
    }
}

Thanks for that Alexandre - we’ll give that a go and see how we get on.
Many thanks,
David

1 Like