Skip to main content

ToFixed

Converts the current form to a fixed size form.

Inherited from ApiFormBase.ToFixed.

Example

Convert a form field to a fixed-size block in a document.

// How do I set a specific width and height for a form field in a document?

// Lock a form's dimensions so layout does not shift when content changes.

let doc = Api.GetDocument();
let textForm = Api.CreateTextForm({"key": "Personal information", "tip": "Enter your first name", "required": true, "placeholder": "First name", "comb": true, "maxCharacters": 10, "cellWidth": 3, "multiLine": false, "autoFit": false});
let paragraph = doc.GetElement(0);
paragraph.AddElement(textForm);
textForm.ToFixed(10 * 240, 2 * 240);
let fixed = textForm.IsFixed();
paragraph = Api.CreateParagraph();
paragraph.AddText("The first form from this document has a fixed size: " + fixed);
doc.Push(paragraph);