TextFrame Object
Description
The TextFrame object represents a rectangle that can be filled with text by an end-user and can be edited like the main text.
Syntax
TextFrameExamples
The following example demonstrates TextFrame in a practical document-editing workflow. The TextFrame object represents a rectangle that can be filled with text by an end-user and can be edited like the main text.
function onTxError(error) {
console.error("TX Text Control error:", error.msg);
error.handled = true;
}
function inspectTextFrame(textFrame) {
textFrame.getID(
function(result) {
console.log("get id result:", result);
},
onTxError
);
}Members
Properties
| Property | Description |
|---|---|
| applicationFields | Gets a collection of all Microsoft Word fields that have been created or imported from a Microsoft Word or RTF document. (Inherited from FormattedText.) |
| comments | Gets a collection of all comments in this text part. (Inherited from FormattedText.) |
| documentLinks | Gets a collection of all links which point to targets in the same document. (Inherited from FormattedText.) |
| documentTargets | Gets a collection of all document targets. (Inherited from FormattedText.) |
| editableRegions | Gets a collection of all editable regions. (Inherited from FormattedText.) |
| formFields | Gets a collection of all form fields in the text part. (Inherited from FormattedText.) |
| frames | Gets a collection of all frames in the document. (Inherited from FormattedText.) |
| hypertextLinks | Gets a collection of all hypertext links. (Inherited from FormattedText.) |
| lines | Gets a collection of all text lines. (Inherited from FormattedText.) |
| misspelledWords | Gets a collection of all misspelled words. (Inherited from FormattedText.) |
| paragraphs | Gets a collection of all paragraphs. (Inherited from FormattedText.) |
| selection | Gets the current selection. (Inherited from FormattedText.) |
| subTextParts | Gets the current subtextparts. (Inherited from FormattedText.) |
| tables | Gets a collection of all tables. (Inherited from FormattedText.) |
| tablesOfContents | Gets the current tables of contents. (Inherited from FormattedText.) |
| textChars | Gets a collection of all text characters. (Inherited from FormattedText.) |
| textFields | Gets a collection of all standard text fields. (Inherited from FormattedText.) |
| textPartType | Gets the Text part type. Possible values are "mainText", "headerFooter" and "textFrame". (Inherited from FormattedText.) |
| trackedChanges | Gets a collection of all tracked changes. (Inherited from FormattedText.) |
Methods
| Method | Description |
|---|---|
| activate | Activates the text frame. The text frame receives the input focus. A text frame can only be activated, if the text part that contains the text frame has the input focus. |
| changeZOrder | Changes the frame's z-order. |
| find | Finds a text string. The search starts at the specified position. (Inherited from FormattedText.) |
| getAlignment | Gets the frame's horizontal alignment when it is anchored to a paragraph. |
| getBackColor | Gets the background color of the text frame. |
| getBorderColor | Gets the border color of the text frame. |
| getBorderStyle | Gets the style of a text frame's border line. |
| getBorderWidth | Gets the width, in twips, of a text frame's border line. |
| getBounds | Gets the frame's bounding rectangle relative to the upper left corner of the document. |
| getDescriptiveText | Gets the descriptive text for the text frame. An empty string indicates that the text frame has no such text. |
| getID | Gets an identifier for the frame. A value of zero indicates that the image, text frame, chart, barcode or drawing has no identifier. |
| getInsertionMode | Gets a value determining whether the frame is treated as a single character or the document's text either flows around or overwrites the frame. If the document's text flows around or overwrites the frame, this property also determines whether the image, text frame, chart, barcode or drawing is moved with the text or fixed positioned on a page. |
| getInternalMargins | Sets the distances, in twips, between the text frame's border line and the text. |
| getLocation | Gets, in twips, the frame's current location. If the image, text frame, chart, barcode or drawing is anchored to a paragraph, the location is relative to the paragraph. Otherwise, it is relative to the document. If the frame has a horizontal alignment or if it is inserted inline, this property returns zero. This property cannot be set for images, text frames, charts, barcodes or drawings which are inserted inline. |
| getMoveable | Gets whether a frame can be moved in the document at run time with the built-in mouse interface. |
| getName | Gets the name for the frame. An empty string indicates that the frame has no name. |
| getSize | Gets the frame's size in twips. |
| getSizeable | Gets whether the frame can be resized at run time with the built-in mouse interface. |
| getTextDistances | Gets the distances, in twips, between the frame and the document's text. |
| getTextFieldsByType | Returns an array of static text field information objects. (Inherited from FormattedText.) |
| getTextPosition | Gets the frame's character position in the document's text (one-based). |
| getTransparency | Gets the text frame's transparency. Zero means opaque and 1.0 means completely transparent. |
| setAlignment | Sets the frame's horizontal alignment when it is anchored to a paragraph. |
| setBackColor | Sets the background color for the text frame. |
| setBorderColor | Sets the border color for the text frame. |
| setBorderStyle | Sets the style of a text frame's border line. |
| setBorderWidth | Sets the width, in twips, of a text frame's border line. To alter the distance between the border line and the text, use the InternalMargins property. If this property is set to zero, the text frame has no border line. |
| setDescriptiveText | Sets a descriptive text for the text frame. An empty string or null can be used to delete a previously set text. |
| setID | Sets an identifier for the frame. It must be a one-based value. A value of zero indicates that the image, text frame, chart, barcode or drawing has no identifier. Zero can also be used to delete a previously set identifier. |
| setInsertionMode | Sets a value determining whether the frame is treated as a single character or the document's text either flows around or overwrites the frame. If the document's text flows around or overwrites the frame, this property also determines whether the image, text frame, chart, barcode or drawing is moved with the text or fixed positioned on a page. |
| setInternalMargins | Sets the distances, in twips, between the text frame's border line and the text. If a value is set to -1, it is not changed. |
| setLocation | Sets, in twips, the frame's current location. If the image, text frame, chart, barcode or drawing is anchored to a paragraph, the location is relative to the paragraph. Otherwise, it is relative to the document. If the frame has a horizontal alignment or if it is inserted inline, this property returns zero. This property cannot be set for images, text frames, charts, barcodes or drawings which are inserted inline. |
| setMoveable | Sets whether a frame can be moved in the document at run time with the built-in mouse interface. |
| setName | Sets a name for the frame. An empty string indicates that the frame has no name. An empty string can also be used to delete a previously set name. |
| setSize | Sets the frame's size in twips. For images this property is read only. |
| setSizeable | Sets whether the frame can be resized at run time with the built-in mouse interface. |
| setTextDistances | Sets the distances, in twips, between the frame and the document's text. If a value is set to -1, it is not changed. |
| setTransparency | Sets the text frame's transparency. It must be a value between 0.0 and 1.0. Zero means opaque and 1.0 means completely transparent. |