Class representing a document text field.
Name | Description |
Clear | Clears the current form. |
Copy | Copies the current form (copies with the shape if it exists). |
GetCharactersLimit | Returns a limit of the text field characters. |
GetClassType | Returns a type of the ApiFormBase class. |
GetFormKey | Returns the current form key. |
GetFormType | Returns a type of the current form. |
GetText | Returns the text from the current form. Returns the value as a string if possible for the given form type |
GetTextPr | Returns the text properties from the current form. Used if possible for this type of form |
GetTipText | Returns the tip text of the current form. |
GetWrapperShape | Returns a shape in which the form is placed to control the position and size of the fixed size form frame. The null value will be returned for the inline forms. |
IsAutoFit | Checks if the text field content is autofit, i.e. whether the font size adjusts to the size of the fixed size form. |
IsComb | Checks if the text field is a comb of characters with the same cell width. |
IsFixed | Checks if the current form is fixed size. |
IsMultiline | Checks if the current text field is multiline. |
IsRequired | Checks if the current form is required. |
MoveCursorOutside | Places a cursor before/after the current form. |
SetAutoFit | Specifies if the text field content should be autofit, i.e. whether the font size adjusts to the size of the fixed size form. |
SetBackgroundColor | Sets the background color to the current form. |
SetBorderColor | Sets the border color to the current form. |
SetCellWidth | Sets the cell width to the applied comb of characters. |
SetCharactersLimit | Sets a limit to the text field characters. |
SetComb | Specifies if the text field should be a comb of characters with the same cell width. The maximum number of characters must be set to a positive value. |
SetFormKey | Sets a key to the current form. |
SetMultiline | Specifies if the current text field should be miltiline. |
SetPlaceholderText | Sets the placeholder text to the current form. Can't be set to checkbox or radio button. |
SetRequired | Specifies if the current form should be required. |
SetText | Sets the text to the current text field. |
SetTextPr | Sets the text properties to the current form. Used if possible for this type of form |
SetTipText | Sets the tip text to the current form. |
ToFixed | Converts the current form to a fixed size form. |
ToInline | Converts the current form to an inline form. Picture form can't be converted to an inline form, it's always a fixed size object. |
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, "autoFit": false}); var oParagraph = oDocument.GetElement(0); oParagraph.AddElement(oTextForm); oTextForm.SetCharactersLimit(5); oTextForm.SetText("John Smith"); oTextForm.SetComb(true); var nLimit = oTextForm.GetCharactersLimit(); var bComb = oTextForm.IsComb(); var bMultiline = oTextForm.IsMultiline(); var bAutoFit = oTextForm.IsAutoFit(); oParagraph = Api.CreateParagraph(); oParagraph.AddText("Characters limit: " + nLimit); oParagraph.AddLineBreak(); oParagraph.AddText("The first text form from this document is comb: " + bComb); oParagraph.AddLineBreak(); oParagraph.AddText("The first text form from this document is multiline: " + bMultiline); oParagraph.AddLineBreak(); oParagraph.AddText("The first text form from this document is autofit: " + bAutoFit); oDocument.Push(oParagraph); builder.SaveFile("docx", "ApiTextForm.docx"); builder.CloseFile();