SetTextPr
Sets the text properties to the current form.
note
Used if possible for this type of form.
Inherited from ApiFormBase.SetTextPr.
Syntax
expression.SetTextPr(textPr);
expression - A variable that represents an ApiCheckBoxForm class.
Parameters
| Name | Required/Optional | Data type | Default | Description |
|---|---|---|---|---|
| textPr | Required | ApiTextPr | The text properties that will be set to the current form. |
Returns
boolean
Example
Apply bold and font-size formatting to a checkbox form in a document.
// How do I change the text appearance of a form field in a document?
// Style a checkbox form with custom font properties so it stands out visually in a document.
let doc = Api.GetDocument();
let checkBoxForm = Api.CreateCheckBoxForm({"key": "Marital status", "tip": "Specify your marital status", "required": true, "placeholder": "Marital status", "radio": true});
let paragraph = doc.GetElement(0);
paragraph.AddElement(checkBoxForm);
let textPr = Api.CreateTextPr();
textPr.SetFontSize(30);
textPr.SetBold(true);
checkBoxForm.SetTextPr(textPr);
paragraph.AddText(" Married");
paragraph.AddLineBreak();
checkBoxForm = Api.CreateCheckBoxForm({"key": "Marital status", "tip": "Specify your marital status", "required": true, "placeholder": "Marital status", "radio": true});
paragraph.AddElement(checkBoxForm);
paragraph.AddText(" Single");
checkBoxForm.SetTipText("Specify your marital status");
let tipText = checkBoxForm.GetTipText();
paragraph = Api.CreateParagraph();
paragraph.AddText("Tip text: " + tipText);
doc.Push(paragraph);