Skip to content

TextFrameItem

TextFrameItem

app.activeDocument.textFrames[index]

Description

The basic art item for displaying text. From the user interface, this is text created with the Text tool. There are three types of text art in Illustrator: point text, path text, and area text. The type is indicated by the text frame’s kind property.

When you create a text frame, you also create a Story object. However, threading text frames combines the frames into a single story object. To thread frames, use the nextFrame or previousFrame property.


Properties

TextFrameItem.anchor

app.activeDocument.textFrames[index].anchor

Description

The position of the anchor point, the start of the base line for point text.

Type

Array of 2 numbers


TextFrameItem.antialias

app.activeDocument.textFrames[index].antialias

Description

The type of anti-aliasing to use in the text.

Type

TextAntialias


TextFrameItem.characters

app.activeDocument.textFrames[index].characters

Description

All the characters in this text frame.

Type

Characters; read-only.


TextFrameItem.columnCount

app.activeDocument.textFrames[index].columnCount

Description

The column count in the text frame (area text only).

Type

Number (long)


TextFrameItem.columnGutter

app.activeDocument.textFrames[index].columnGutter

Description

The column gutter in the text frame (area text only).

Type

Number (double)


TextFrameItem.contents

app.activeDocument.textFrames[index].contents

Description

The text string.

Type

String


TextFrameItem.contentVariable

app.activeDocument.textFrames[index].contentVariable

Description

The content variable bound to this text frame item.

Type

Variable


TextFrameItem.endTValue

app.activeDocument.textFrames[index].endTValue

Description

The end position of text along a path, as a value relative to the path’s segments (path text only).

Type

Number (double)


TextFrameItem.flowLinksHorizontally

app.activeDocument.textFrames[index].flowLinksHorizontally

Description

If true, flow text between linked frames horizontally first (area text only).

Type

Boolean


TextFrameItem.insertionPoints

app.activeDocument.textFrames[index].insertionPoints

Description

All the insertion points in this text range.

Type

InsertionPoints; read-only.


TextFrameItem.kind

app.activeDocument.textFrames[index].kind

Description

The type of a text frame item (area, path or point).

Type

TextType; read-only.


TextFrameItem.lines

app.activeDocument.textFrames[index].lines

Description

All the lines in this text frame.

Type

Lines; read-only.


TextFrameItem.matrix

app.activeDocument.textFrames[index].matrix

Description

The transformation matrix for this text frame.

Type

Matrix; read-only.


TextFrameItem.nextFrame

app.activeDocument.textFrames[index].nextFrame

Description

The linked text frame following this one.

Type

TextFrameItem


TextFrameItem.opticalAlignment

app.activeDocument.textFrames[index].opticalAlignment

Description

If true, the optical alignment feature is active.

Type

Boolean


TextFrameItem.orientation

app.activeDocument.textFrames[index].orientation

Description

The orientation of the text.

Type

TextOrientation


TextFrameItem.paragraphs

app.activeDocument.textFrames[index].paragraphs

Description

All the paragraphs in this text frame.

Type

Paragraphs; read-only.


TextFrameItem.parent

app.activeDocument.textFrames[index].parent

Description

The parent of this object.

Type

Layer or GroupItem; read-only.


TextFrameItem.previousFrame

app.activeDocument.textFrames[index].previousFrame

Description

The linked text frame preceding this one.

Type

TextFrameItem


TextFrameItem.rowCount

app.activeDocument.textFrames[index].rowCount

Description

The row count in the text frame (area text only).

Type

Number (long)


TextFrameItem.rowGutter

app.activeDocument.textFrames[index].rowGutter

Description

The row gutter in the text frame (area text only).

Type

Number (double)


TextFrameItem.spacing

app.activeDocument.textFrames[index].spacing

Description

The amount of spacing.

Type

Number (double)


TextFrameItem.startTValue

app.activeDocument.textFrames[index].startTValue

Description

The start position of text along a path, as a value relative to the path’s segments (path text only).

Type

Number (double)


TextFrameItem.story

app.activeDocument.textFrames[index].story

Description

The story to which the text frame belongs.

Type

Story; read-only.


TextFrameItem.textPath

app.activeDocument.textFrames[index].textPath

Description

The path item associated with the text frame. Note: Valid only when kind is area or path.

Type

TextPath


TextFrameItem.textRange

app.activeDocument.textFrames[index].textRange

Description

The text range of the text frame.

Type

TextRange; read-only.


TextFrameItem.textRanges

app.activeDocument.textFrames[index].textRanges

Description

All the text in this text frame.

Type

TextRanges; read-only.


TextFrameItem.textSelection

app.activeDocument.textFrames[index].textSelection

Description

The selected text range(s) in the text frame.

Type

Array of TextRange; read-only.


TextFrameItem.typename

app.activeDocument.textFrames[index].typename

Description

The class name of the referenced object.

Type

String; read-only.


TextFrameItem.words

app.activeDocument.textFrames[index].words

Description

All the words in this text frame.

Type

Words; read-only.


Methods

TextFrameItem.convertAreaObjectToPointObject()

app.activeDocument.textFrames[index].convertAreaObjectToPointObject()

Description

Converts the area-type text frame to a point-type text frame.

Returns

TextFrameItem


TextFrameItem.convertPointObjectToAreaObject()

app.activeDocument.textFrames[index].convertPointObjectToAreaObject()

Description

Converts the point-type text frame to an area-type text frame.

Returns

TextFrameItem


TextFrameItem.createOutline()

app.activeDocument.textFrames[index].createOutline()

Description

Converts the text in the text frame to outlines.

Returns

GroupItem


TextFrameItem.duplicate()

app.activeDocument.textFrames[index].duplicate([relativeObject] [,insertionLocation])

Description

Creates a duplicate of the selected object.

Parameters

ParameterTypeDescription
relativeObjectObject, optionalObject to duplicate to
insertionLocationElementPlacement, optionalLocation to insert element

Returns

TextRange


TextFrameItem.move()

app.activeDocument.textFrames[index].move(relativeObject, insertionLocation)

Description

Moves the object.

Parameters

ParameterTypeDescription
relativeObjectObjectObject to move element within
insertionLocationElementPlacement, optionalLocation to move element to

Returns

TextRange


TextFrameItem.remove()

app.activeDocument.textFrames[index].remove()

Description

Deletes this object.

Returns

Nothing.


TextFrameItem.resize()

app.activeDocument.textFrames[index].resize(
scaleX,
scaleY
[,changePositions]
[,changeFillPatterns]
[,changeFillGradients]
[,changeStrokePattern]
[,changeLineWidths]
[,scaleAbout]
)

Description

Scales the art item where scaleX is the horizontal scaling factor and scaleY is the vertical scaling factor. 100.0 = 100%.

Parameters

ParameterTypeDescription
scaleXNumber (double)Horizontal scaling factor
scaleYNumber (double)Vertical scaling factor
changePositionsBoolean, optionalWhether to effect art object positions and orientations
changeFillPatternsBoolean, optionalWhether to transform fill patterns
changeFillGradientsBoolean, optionalWhether to transform fill gradients
changeStrokePatternBoolean, optionalWhether to transform stroke patterns
changeLineWidthsNumber (double), optionalThe amount to scale line widths
scaleAboutTransformation, optionalThe point to use as anchor, to transform about

Returns

Nothing.


TextFrameItem.rotate()

app.activeDocument.textFrames[index].rotate(
angle
[,changePositions]
[,changeFillPatterns]
[,changeFillGradients]
[,changeStrokePattern]
[,rotateAbout]
)

Description

Rotates the art item relative to the current rotation. The object is rotated counter-clockwise if the angle value is positive, clockwise if the value is negative.

Parameters

ParameterTypeDescription
angleNumber (double)The angle amount to rotate the element
changePositionsBoolean, optionalWhether to effect art object positions and orientations
changeFillPatternsBoolean, optionalWhether to transform fill patterns
changeFillGradientsBoolean, optionalWhether to transform fill gradients
changeStrokePatternBoolean, optionalWhether to transform stroke patterns
rotateAboutTransformation, optionalThe point to use as anchor, to transform about

Returns

Nothing.


TextFrameItem.transform()

app.activeDocument.textFrames[index].transform(
transformationMatrix
[, changePositions]
[, changeFillPatterns]
[, changeFillGradients]
[, changeStrokePattern]
[, changeLineWidths]
[, transformAbout]
)

Description

Transforms the art item by applying a transformation matrix.

Parameters

ParameterTypeDescription
transformationMatrixMatrixTransformation matrix to apply
changePositionsBoolean, optionalWhether to change Positions
changeFillPatternsBoolean, optionalWhether to change Fill Patterns
changeFillGradientsBoolean, optionalWhether to change Fill Gradients
changeStrokePatternBoolean, optionalWhether to change Stroke Pattern
changeLineWidthsNumber (double), optionalThe amount to scale line widths
transformAboutTransformation, optionalThe point to use as anchor, to transform about

Returns

Nothing.


TextFrameItem.translate()

app.activeDocument.textFrames[index].translate(
[deltaX]
[, deltaY]
[, transformObjects]
[, transformFillPatterns]
[, transformFillGradients]
[, transformStrokePatterns]
)

Description

Repositions the art item relative to the current position, where deltaX is the horizontal offset and deltaY is the vertical offset.

Parameters

ParameterTypeDescription
deltaXNumber (double), optionalHorizontal offset
deltaYNumber (double), optionalVertical offset
transformObjectsBoolean, optionalWhether to transform Objects
transformFillPatternsBoolean, optionalWhether to transform Fill Patterns
transformFillGradientsBoolean, optionalWhether to transform Fill Gradients
transformStrokePatternsBoolean, optionalWhether to transform Stroke Patterns

Returns

Nothing.


TextFrameItem.zOrder()

app.activeDocument.textFrames[index].zOrder(zOrderCmd)

Description

Arranges the art item’s position in the stacking order of the group or layer (parent) of this object.

Parameters

ParameterTypeDescription
zOrderCmdZOrderMethodStacking order arrangement method

Returns

Nothing.


Example

Rotate a text art item

// Duplicates and rotates the selected text art item 5 times
if ( app.documents.length > 0 ) {
selectedItems = app.activeDocument.selection;
// make sure something is selected.
if ( selectedItems.length > 0 ) {
// The selection must be a text art item
if ( selectedItems[0].typename == "TextFrame" ) {
// Get the parent of the text art so new text art items
// can be inserted in the same group or layer
dupSrc = selectedItems[0];
textContainer = dupSrc.parent;
// Create 5 new versions of the text art each rotated a bit
for ( i = 1; i <= 5; i++ ) {
dupText = dupSrc.duplicate( textContainer, ElementPlacement.PLACEATEND );
dupText.rotate(180 * i/6);
}
}
}
}