Hi Laurent,
using macros (but any language welcomed)
I retreive a paragraph containing text. Is there a way to know how many lines it represents displayed in the document ? (so, depending on the formats, font, font size aso)
I know i can count characters with num = Len(myParagraph.string) but need know that this number is displayed on N lines
I suppose you have an XTextRange as base for your calculation.
The following macro should count the lines of a selected text, but by replacing the first line with your text range it should work for you too :-)
textRange = thiscomponent.currentcontroller.Selection.getByIndex(0) textCursor = thisComponent.getText.createTextCursorByRange(textRange) viewCursor = thisComponent.currentcontroller.ViewCursor() viewCursor.gotoRange(textRange,false) viewCursor.collapseToStart() counter = 0 while thiscomponent.getText.compareRegionEnds(textCursor,viewCursor)<0 viewCursor.goDown(1,false) counter = counter +1 wend msgbox "lines in selected paragraph "+counter
Hope that helps
Regards
Stephan
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]