SetAutoFit
Specifies if the text form content should be autofit, i.e. whether the font size adjusts to the size of the fixed size form.
Parameters:
Name |
Type |
Description |
bAutoFit |
boolean
|
Defines if the text form content is autofit (true) or not (false). |
Returns:
- Type
-
boolean
Example
Copy code
builder.CreateFile("docx");
var oDocument = Api.GetDocument();
var oTextForm = Api.CreateTextForm({"key": "Personal information", "tip": "Enter your first name", "required": true, "placeholder": "First name", "multiLine": false});
var oParagraph = oDocument.GetElement(0);
oParagraph.AddElement(oTextForm);
oTextForm.ToFixed(6 * 240, 2 * 240);
oTextForm.SetAutoFit(true);
var bAutoFit = oTextForm.IsAutoFit();
oParagraph = Api.CreateParagraph();
oParagraph.AddText("The first text form from this document is autofit: " + bAutoFit);
oDocument.Push(oParagraph);
builder.SaveFile("docx", "SetAutoFit.docx");
builder.CloseFile();
Resulting document