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 ApiPictureForm 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 custom font styling to the text inside a picture field in a document.
// How do I change the font size and weight of the label text shown in a picture field in a document?
// Style the caption text of a picture field with bold and a larger size in a document.
let doc = Api.GetDocument();
let pictureForm = Api.CreatePictureForm({"key": "Personal information", "required": true, "placeholder": "Photo", "scaleFlag": "tooBig", "lockAspectRatio": true, "respectBorders": false, "shiftX": 50, "shiftY": 50});
pictureForm.SetImage("https://static.onlyoffice.com/assets/docs/samples/img/onlyoffice_logo.png", Api.MillimetersToEmus(70), Api.MillimetersToEmus(80));
let paragraph = doc.GetElement(0);
paragraph.AddElement(pictureForm);
pictureForm.SetTipText("Upload your photo");
let textPr = Api.CreateTextPr();
textPr.SetFontSize(30);
textPr.SetBold(true);
pictureForm.SetTextPr(textPr);