Mohammad Alhammouri schrieb:
Hello there,
is there a similar function to the page number function
xPageCursor.getPage(),
that finds the paragraph number within the text document.
if not is there any way to find that number in JAVA ?
thanks in advance.
Regards,
Mohammad.
hi,
i am not sure if this might help you, but you can enumerate the
text::Paragraphs inside a text::Text.
e.g.:
// get all text from the document
::css::uno::Reference< css::text::XText > text =
textDocument->getText(); //
// this should be a text::Text Service. It offers the XEnumerationAccess
// to enumerate paragraphs
::css::uno::Reference< ::css::container::XEnumerationAccess >
paragraphEnumerationAccess (text, ::css::uno::UNO_QUERY);
// get the enumeration
::css::uno::Reference< ::css::container::XEnumeration >
paragraphEnumeration =
paragraphEnumerationAccess->createEnumeration();
// enumrate
while ( paragraphEnumeration->hasMoreElements())
{
::css::uno::Any anyParagraph =
paragraphEnumeration->nextElement();
::css::uno::Reference< ::css::text::XTextContent > paragraph(0);
anyParagraph >>= paragraph;
}
if you want to go deeper into the paragraph, you can get another
XEnumerationAccess interface from the Paragraph service. This will give
you access to TextPortions.
see:
http://api.openoffice.org/docs/common/ref/com/sun/star/text/Paragraph.html
http://api.openoffice.org/docs/common/ref/com/sun/star/text/TextPortion.html
http://api.openoffice.org/docs/DevelopersGuide/Text/Text.xhtml#1_3_1_2_Iterating_over_Text
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]