Base class
Name | Description |
CreateCheckBoxForm | Creates a checkbox / radio button with the specified checkbox / radio button properties. |
CreateComboBoxForm | Creates a combo box / dropdown list with the specified combo box / dropdown list properties. |
CreatePictureForm | Creates a picture form with the specified picture form properties. |
CreateTextForm | Creates a text field with the specified text field properties. |
builder.CreateFile("docx"); var oDocument = Api.GetDocument(); var oTextForm = Api.CreateTextForm({"key": "First name", "tip": "Enter your first name", "required": true, "placeholder": "First name", "comb": true, "maxCharacters": 10, "cellWidth": 3, "multiLine": false, "autoFit": false}); var oParagraph = oDocument.GetElement(0); oParagraph.AddElement(oTextForm); oParagraph.AddLineBreak(); var oComboBoxForm = Api.CreateComboBoxForm({"key": "Country", "tip": "Choose your country", "required": true, "placeholder": "Country", "editable": false, "autoFit": false, "items": ["Latvia", "USA", "UK"]}); oParagraph = oDocument.GetElement(0); oParagraph.AddElement(oComboBoxForm); oParagraph.AddLineBreak(); var oCheckBoxForm = Api.CreateCheckBoxForm({"key": "Marital status", "tip": "Specify your marital status", "required": true, "placeholder": "Marital status", "radio": true}); oParagraph = oDocument.GetElement(0); oParagraph.AddElement(oCheckBoxForm); oParagraph.AddText(" Married"); oParagraph.AddLineBreak(); oCheckBoxForm = Api.CreateCheckBoxForm({"key": "Marital status", "tip": "Specify your marital status", "required": true, "placeholder": "Marital status", "radio": true}); oParagraph.AddElement(oCheckBoxForm); oParagraph.AddText(" Single"); oParagraph.AddLineBreak(); var oPictureForm = Api.CreatePictureForm({"key": "Photo", "tip": "Upload your photo", "required": true, "placeholder": "Photo", "scaleFlag": "tooBig", "lockAspectRatio": true, "respectBorders": false, "shiftX": 50, "shiftY": 50}); oParagraph = oDocument.GetElement(0); oParagraph.AddElement(oPictureForm); oPictureForm.SetImage("https://api.onlyoffice.com/content/img/docbuilder/examples/user-profile.png"); builder.SaveFile("docxf", "Api.docxf"); builder.CloseFile();