GetFormsData

function GetFormsData(): FormData[]

Description

Returns the data from all forms present in the current document. If a form was created and not assigned to any part of the document, it won't appear in this list.

Returns

FormData[]

Try It

var oDocument = Api.GetDocument();
var oParagraph1 = oDocument.GetElement(0);
var oCheckBox = Api.CreateCheckBoxForm({key: "BestCompany"});
oCheckBox.SetChecked(true);
oParagraph1.Push(oCheckBox);
var oTextForm = Api.CreateTextForm({key: "CompanyName"});
oTextForm.SetText("OnlyOffice");
oParagraph1.Push(oTextForm);

var sText = JSON.stringify(oDocument.GetFormsData());
let oParagraph2 = Api.CreateParagraph();
oParagraph2.AddText(sText);
oDocument.Push(oParagraph2);

Get Help

  • If you have any questions about ONLYOFFICE Docs, try the FAQ section first.
  • You can request a feature or report a bug by posting an issue on GitHub.
  • You can also ask our developers on ONLYOFFICE forum (registration required).