Hello,
I remember that I had once a similar problem. I solved it by creating a
XTextRange ranging from "start" to "end" and then by getting the size of
the text of that XTextRange.
Here some pseudo code (I cannot post real code since I have no Java
environment here)
//Creates the XTextRange ranging from start to end
xtextRange.goto(START)
xtextRange.goto(END)
//Returns the size of the XTextRange in number of characters:
xtextRange.getText().getString().length();
I'm not sure if the returned size does match the number of characters
under the windows OS if a line break happens to be in that XTextRange. A
trick like this should solve the problem:
String text =xtextRange.getText().getString().length();
if (System.getProperty("os.name").startsWith("Windows"))
text = text.replaceAll(System.getProperty("line.separator"), "\n");
return text.length()
I sadly found no easier way to count characters in a XTextRange.
Regards,
Daniel
Hello Guys !!!
I need some help... i have two XTextRange ... the Start and The END...
exist way to return a position in the of this ranges ?
ex:
XTextRangeEND - XTextRangeSTART = 13
The Range have a 13 chars...
exists way ?
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]