Support for Creating and Adding Fields via API in OnlyOffice Document Server 8.2

Hello everyone,

As a long-term user of OnlyOffice, I greatly appreciate the document handling capabilities that the platform offers. Recently, I noticed some new field functionalities introduced in the latest version 8.2 of OnlyOffice Document Server, which are extremely helpful for automating our document processing.

I am keen to know when we will be able to create and add these new fields to documents via the API? This feature is crucial for us as it can significantly enhance our efficiency, especially when dealing with a large volume of documents that require automated filling of specific information.

I hope the OnlyOffice development team can provide some information or a development roadmap concerning the support for field APIs. Any timeline or plans would be very helpful.

Thank you to the OnlyOffice team for your continuous efforts and innovation. I look forward to any replies and assistance!

Best regards

1 Like

Hello @yu3278326

Thanks for the suggestion and your interest. As it is new functionality I believe respective methods will be introduced later. I have to admit that currently there is no ETA available. I will keep you posted about the news on that matter.

Hello again @yu3278326

Sorry for the delayed response. I’d like to inform you that the suggestion to implement methods to interact with Fields was registered. New methods will be available in one of the future releases of Document Server.

Hello @softboy99

We have just released new version 9.0 of Document Server that brings new method AddField(code) for inserting a field into a document. Here is an example of usage of this method:

// This example adds the field to the specified range by field instruction code.
// Note: This method removes text within range.
let doc = Api.GetDocument();
let paragraph = doc.GetElement(0);
paragraph.AddText("This text for time field");
let range = paragraph.GetRange();
range.AddField('TIME \\@ "dddd, MMMM d, yyyy"');
paragraph = Api.CreateParagraph();
paragraph.AddText("The text within range was replaced by field with TIME instruction field.");
doc.Push(paragraph);

Pay attention to the way the code is defined – since the code itself contains double quotation marks in it, you need to wrap whole code into a single quotation marks to avoid issues.

Official documentation on this method will become available shortly.