TextRange
TextRange
Section titled “TextRange”app.activeDocument.textFrames[index].textRange
特定文本艺术项中的文本范围。TextRange 使您可以访问文本艺术项中包含的文本。
TextRange.characterAttributes
Section titled “TextRange.characterAttributes”app.activeDocument.textFrames[index].textRange.characterAttributes
文本范围的字符属性。
CharacterAttributes; 只读。
TextRange.characterOffset
Section titled “TextRange.characterOffset”app.activeDocument.textFrames[index].textRange.characterOffset
第一个字符的偏移量。
Number (long)
TextRange.characters
Section titled “TextRange.characters”app.activeDocument.textFrames[index].textRange.characters
此文本范围中的所有字符。
Characters; 只读。
TextRange.characterStyles
Section titled “TextRange.characterStyles”app.activeDocument.textFrames[index].textRange.characterStyles
文本范围中所有引用的字符样式。
CharacterStyles; 只读。
TextRange.contents
Section titled “TextRange.contents”app.activeDocument.textFrames[index].textRange.contents
文本字符串。
String
TextRange.end
Section titled “TextRange.end”app.activeDocument.textFrames[index].textRange.end
文本范围的结束索引。
Int32
TextRange.insertionPoints
Section titled “TextRange.insertionPoints”app.activeDocument.textFrames[index].textRange.insertionPoints
此文本范围中的所有插入点。
InsertionPoints; 只读。
TextRange.kerning
Section titled “TextRange.kerning”app.activeDocument.textFrames[index].textRange.kerning
控制两个字符之间的间距,以千分之一 em 为单位。整数。
Number (long)
TextRange.length
Section titled “TextRange.length”app.activeDocument.textFrames[index].textRange.length
长度(以字符为单位)。最小值:0
Number (long)
TextRange.lines
Section titled “TextRange.lines”app.activeDocument.textFrames[index].textRange.lines
此文本范围中的所有行。
Lines; 只读。
TextRange.paragraphAttributes
Section titled “TextRange.paragraphAttributes”app.activeDocument.textFrames[index].textRange.paragraphAttributes
文本范围的段落属性。
ParagraphAttributes; 只读。
TextRange.paragraphs
Section titled “TextRange.paragraphs”app.activeDocument.textFrames[index].textRange.paragraphs
此文本范围中的所有段落。
Paragraphs; 只读。
TextRange.paragraphStyles
Section titled “TextRange.paragraphStyles”app.activeDocument.textFrames[index].textRange.paragraphStyles
文本范围中所有引用的段落样式。
ParagraphStyles; 只读。
TextRange.parent
Section titled “TextRange.parent”app.activeDocument.textFrames[index].textRange.parent
对象的容器。
TextRange; 只读。
TextRange.start
Section titled “TextRange.start”app.activeDocument.textFrames[index].textRange.start
文本范围的起始索引。
Int32
TextRange.story
Section titled “TextRange.story”app.activeDocument.textFrames[index].textRange.story
文本范围所属的故事。
Story; 只读。
TextRange.textRanges
Section titled “TextRange.textRanges”app.activeDocument.textFrames[index].textRange.textRanges
此文本范围中的所有文本。
TextRanges; 只读。
TextRange.textSelection
Section titled “TextRange.textSelection”app.activeDocument.textFrames[index].textRange.textSelection
文本范围中选中的文本范围。
TextRange 数组; 只读。
TextRange.typename
Section titled “TextRange.typename”app.activeDocument.textFrames[index].textRange.typename
对象的类名。
String; 只读。
TextRange.words
Section titled “TextRange.words”app.activeDocument.textFrames[index].textRange.words
此文本范围中包含的所有单词。
Words; 只读。
TextRange.changeCaseTo()
Section titled “TextRange.changeCaseTo()”app.activeDocument.textFrames[index].textRange.changeCaseTo(type)
更改文本的大小写。
参数 | 类型 | 描述 |
---|---|---|
type | CaseChangeType | 要更改的大小写类型 |
无
TextRange.deSelect()
Section titled “TextRange.deSelect()”app.activeDocument.textFrames[index].textRange.deSelect()
取消选择文本范围。
无。
TextRange.duplicate()
Section titled “TextRange.duplicate()”app.activeDocument.textFrames[index].textRange.duplicate([relativeObject][, insertionLocation])
创建此对象的副本。
参数 | 类型 | 描述 |
---|---|---|
relativeObject | Object, 可选 | 要复制到的对象 |
insertionLocation | ElementPlacement, 可选 | 插入元素的位置 |
TextRange.getLocalCharOverridesJSON()
Section titled “TextRange.getLocalCharOverridesJSON()”app.activeDocument.textFrames[index].textRange.getLocalCharOverridesJSON()
获取字符覆盖的 JSON 表示。
String
TextRange.getLocalParaOverridesJSON()
Section titled “TextRange.getLocalParaOverridesJSON()”app.activeDocument.textFrames[index].textRange.getLocalParaOverridesJSON()
获取段落覆盖的 JSON 表示。
String
TextRange.getParagraphLength()
Section titled “TextRange.getParagraphLength()”app.activeDocument.textFrames[index].textRange.getParagraphLength()
获取文本范围中第一个段落的长度。
Int32
TextRange.getTextRunLength()
Section titled “TextRange.getTextRunLength()”app.activeDocument.textFrames[index].textRange.getTextRunLength()
获取文本范围中第一个文本运行的长度。
Int32
TextRange.move()
Section titled “TextRange.move()”app.activeDocument.textFrames[index].textRange.move(relativeObject, insertionLocation)
移动对象。
参数 | 类型 | 描述 |
---|---|---|
relativeObject | Object | 要移动元素的对象 |
insertionLocation | ElementPlacement, 可选 | 移动元素到的位置 |
TextRange.remove()
Section titled “TextRange.remove()”app.activeDocument.textFrames[index].textRange.remove()
删除对象。
无
TextRange.select()
Section titled “TextRange.select()”app.activeDocument.textFrames[index].textRange.select([addToDocument])
选择文本范围。
参数 | 类型 | 描述 |
---|---|---|
addToDocument | Boolean, 可选 | 是否添加或替换当前选择 |
无
// 通过更改每个字符的大小属性来更改当前文档中每个单词的第一个字符的大小
if ( app.documents.length > 0 ) { for ( i = 0; i < app.activeDocument.textFrames.length; i++ ) { var text = app.activeDocument.textFrames[i].textRange; for ( j = 0 ; j < text.words.length; j++ ) { // 每个单词都是一个 textRange 对象 var textWord = text.words[j];
// 字符也是 textRange 对象。 // 获取每个单词的第一个字符并增加其大小。
var firstChars = textWord.characters[0]; firstChars.size = firstChars.size * 1.5; } }}