Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Split TextFrame Lines

Community Beginner ,
Aug 26, 2010 Aug 26, 2010

Hi,

I need to get the position of all texts of an Illustrator document.

It's pretty easy for single lines because I have the position of TextFrame

For each tf in docRef.TextFrames

     position = tf.Position

Next

But if the TextFrame has multiple lines, I really don't know how to do.

For each tf in docRef.TextFrames

     For each line in tf.Lines               'line is a TextRange

     ????

     Next

Next

There isn't the "Position" property for TextRange objects...

I wonder if the best way would be to split/demerge lines of a TextRange into separated TextRange so I would be able to know the position of them.

But is it possible to do this ? how ? or is there another solution ?

I saw on the Internet a script to merge separated TextFrame into a single one but I would like to do the opposite...

Here is the link of the merging : http://indesignsecrets.com/merging-multiple-text-frames-into-one.php

Help 🙂

TOPICS
Scripting
1.4K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Aug 30, 2010 Aug 30, 2010

Hi Jean, there is a script to split multiline textFrames into single line textFrames, made by Wundes. But there's no need to do that...

in a 3 line textFrame

- the 1st line's position = textFrame position

- the 2nd line's position = textFrame position - Leading

- the 3rd line's position = textFrame position - Leading * 2

in the following VBA snip I did split the text and wrote the position of the lines on single frames, but you can get the position directly without splitting

    Set txtFrame = Idoc.Se

...
Translate
Adobe
Community Expert ,
Aug 30, 2010 Aug 30, 2010

Hi Jean, there is a script to split multiline textFrames into single line textFrames, made by Wundes. But there's no need to do that...

in a 3 line textFrame

- the 1st line's position = textFrame position

- the 2nd line's position = textFrame position - Leading

- the 3rd line's position = textFrame position - Leading * 2

in the following VBA snip I did split the text and wrote the position of the lines on single frames, but you can get the position directly without splitting

    Set txtFrame = Idoc.Selection(0)

   

    txtLeading = txtFrame.Story.TextRange.CharacterAttributes.Leading

   

    For i = 1 To txtFrame.Lines.Count

        Set txtline = Idoc.TextFrames.Add

        txtFrame.Lines(i).Duplicate txtline, 1

        txtline.Position = txtFrame.Position

        txtline.Top = txtline.Top - txtLeading * (i - 1)

        txtline.Left = txtFrame.Left - txtFrame.Width

        txtline.Contents = "Y = " & txtline.Top

    Next

splittext.PNG
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Aug 30, 2010 Aug 30, 2010
LATEST

Hi,

Pretty cool !

I would never thought to do this like that.

Very helpful thank you !

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines