Copy link to clipboard
Copied
Hi All,
Please tell me how to get the line number of the selected text in a page.
for example
Consider, below is the page with some text, in that i want to get the line number of that selected(marked in red) text
|-------------------------|
|xxxxxxxxxxxxxx|
|xxxxxxxxxx |
|xxxxxxxxxxxxxx|
|xxxxxxxxxxxxxx|
|xxxxxxxxxx |
|xxxxxxxxxxxxxx|
|xxxxxxxxxxxxxx|
---------------------------
Thanks in Advance
Shiv
Hi Shiv,
Checkout this thread. This will give you idea.
Always search in forum first before creating new one.
Shonky
Copy link to clipboard
Copied
Hi Shiv,
Checkout this thread. This will give you idea.
Always search in forum first before creating new one.
Shonky
Copy link to clipboard
Copied
Hi Shonky,
First, thanks for your reply and its woking fine for me but, the only thing is, its not counting empty line.
Is there any way to do that?
below is my try
app.findTextPreferences = app.changeTextPreferences = null;
app.findTextPreferences.findWhat = "XXX";
var arrFoundItems = new Array;
myFoundSet =app.activeDocument.findText (true);
if(myFoundSet.length != 0)
{
for(var n = 0; n < myFoundSet.length; n ++)
{
linecnt = myFoundSet
alert(paragraph_index);
}
}
Thanks
Shiv
Copy link to clipboard
Copied
Here is an easier method (it counts empty lines):
myText = // whatever
myTF = myText.parentTextFrames[0];
line_number = myTF.characters.itemByRange (myTF.characters[0], myText).lines.length;
Peter
Copy link to clipboard
Copied
Hi Peter,
Great!!!!
Thanks a lot.....
Shiv
Copy link to clipboard
Copied
Hi,
Its returning page number of selected text but its throwing error for selected text in footnote.
How can i get the line number of text in Foot Note?? help me...
Thanks,
Sudha K
Find more inspiration, events, and resources on the new Adobe Community
Explore Now