SetFormsData

SetFormsData(arrData)

Sets the data to the specified forms.

Parameters:

Name Type Description
arrData Array.<FormData>

An array of form data to set to the specified forms.

Returns:

This method doesn't return any data.

Example

Copy code
builder.CreateFile("docx");
var oDocument = Api.GetDocument();
var oParagraph1 = oDocument.GetElement(0);
var oCheckBox = Api.CreateCheckBoxForm({"key": "BestCompany"});
oParagraph1.Push(oCheckBox);
var oTextForm = Api.CreateTextForm({"key": "CompanyName"});
oParagraph1.Push(oTextForm);
oDocument.SetFormsData([
    {"key": "BestCompany", "value": true},
    {"key": "CompanyName", "value": "ONLYOFFICE"}
]);
builder.SaveFile("docx", "SetFormsData.docx");
builder.CloseFile();

Resulting document