Skip to main content
daitranthanhoa
Inspiring
June 28, 2019
Question

Why length of textranges equal number of characters?

  • June 28, 2019
  • 2 replies
  • 400 views

I add new a TextFrame and set text="1234"

I not change any attributes.

But i get  textranges.length=4

With Indesign textStyleRanges.length=1, it only change when change attributes of text.

Why length of textranges equal number of character?

This topic has been closed for replies.

2 replies

Silly-V
Legend
June 28, 2019

There are various reference paths, is the only thing I can think of what to call it, so you can use textFrame.textRange to get the whole contents. But that textRange.textRanges appears to also reference the characters.

There are also other text-containers for text inside of text boxes such as lines and paragraphs.

textFrame.textRange.lines[0].textRanges exists, but apparently there's no line.textRange (singular) object..

If there is a diagram of this somewhere, it would be useful - but for me it's been just years of trial and error to see what works for my needs.

CarlosCanto
Community Expert
Community Expert
June 28, 2019

why? I don't know, that's how it works in Illustrator.