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

Line number of selected text from footnote

Contributor ,
Dec 04, 2014 Dec 04, 2014

Hi,

  I can get the line number of selected text from document but throwing the error for footnote.  How can i get the line number for text from footnote.

Can anyone guide me...

function getLineNumber(myText)

{   

    try{

        var myTF = myText.parentTextFrames[0];

        //myTF.select()

        line_number = myTF.characters.itemByRange(myTF.characters[0], myText).lines.length;

        line_number = line_number-1;

        return line_number;

    }catch(e){return null;}

}

Thanks in advance,

Sudha K

TOPICS
Scripting
692
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 Expert ,
Dec 04, 2014 Dec 04, 2014

Do you want the number of the line in which the footnote reference occurs, or the number of the line in the footnote?

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
Contributor ,
Dec 04, 2014 Dec 04, 2014

Hi,

  Number of the line in the footnote... both will be useful.

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 Expert ,
Dec 05, 2014 Dec 05, 2014

Number of the line of the footnote reference: get the insertion point of the footnote in the main text:

try{

    if (myText.parent instanceof Footnote) {

          myText = myText.parent.storyOffset;

    }

    var myTF = myText.parentTextFrames[0];

    . . .

Number of the line in the footnote: you can't use the text frame, clearly, so you need to use the range from the beginning of the note. That is, is the note starts on the same page. If the note starts on an earlier page, you have to make another decision: do you want the number of the line in the note on this particular page or the number from the beginning of the note? Both would be useful, you will say -- so a good task for you to figure out.

Peter

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
Contributor ,
Dec 07, 2014 Dec 07, 2014
LATEST

Hi,

  I want the line number of the footnote contents of the particular page.

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