Skip to main content

ToFixed

Converts the current form to a fixed size form.

Inherited from ApiFormBase.ToFixed.

Syntax​

expression.ToFixed(width, height, keepPosition);

expression - A variable that represents an ApiDateForm class.

Parameters​

NameRequired/OptionalData typeDefaultDescription
widthRequiredtwipsThe wrapper shape width measured in twentieths of a point (1/1440 of an inch).
heightRequiredtwipsThe wrapper shape height measured in twentieths of a point (1/1440 of an inch).
keepPositionRequiredbooleanSave position on the page (it can be a little bit slow, because it runs the document calculation).

Returns​

boolean

Example​

Convert a date form to a fixed-size form in a document.

// How do I give a date form a fixed width and height in a document?

// Lock the dimensions of a date form so it does not resize with its content in a document.

let doc = Api.GetDocument();
let dateForm = Api.CreateDateForm({"key": "Nowadays", "tip": "Enter current date", "required": true, "placeholder": "Your date here", "format": "mm.dd.yyyy", "lang": "en-US"});
let paragraph = doc.GetElement(0);
paragraph.AddElement(dateForm);
dateForm.ToFixed(10 * 240, 2 * 240);
let fixed = dateForm.IsFixed();
paragraph = Api.CreateParagraph();
paragraph.AddText("The first form from this document has a fixed size: " + fixed);
doc.Push(paragraph);