Skip to main content

GetTag

Returns the tag attribute for the current form.

Inherited from ApiFormBase.GetTag.

Syntax​

expression.GetTag();

expression - A variable that represents an ApiPictureForm class.

Parameters​

This method doesn't have any parameters.

Returns​

string

Example​

Retrieve the tag label attached to a picture form in a document.

// How do I read the tag that was set on a picture form in a document?

// Look up the custom label stored with a picture form in a document.

let doc = Api.GetDocument();
let pictureForm = Api.CreatePictureForm({"tag" : "Personal", "key": "Personal information", "tip": "Upload your photo", "required": true, "placeholder": "Photo", "scaleFlag": "tooBig", "lockAspectRatio": true, "respectBorders": false, "shiftX": 50, "shiftY": 50});
let paragraph = doc.GetElement(0);
paragraph.AddElement(pictureForm);
pictureForm.SetImage("https://static.onlyoffice.com/assets/docs/samples/img/onlyoffice_logo.png", Api.MillimetersToEmus(70), Api.MillimetersToEmus(80));
let tag = pictureForm.GetTag();
paragraph = Api.CreateParagraph();
paragraph.AddText("Form tag: " + tag);
doc.Push(paragraph);