ashok _ wrote:
I am trying to translate this StarBasic construct to Java:

theTextElement = oTextEnum.nextElement
    If theTextElement.supportsService("com.sun.star.text.Paragraph") Then
        If theTextElement.ParaChapterNumberingLevel >= 0 then
                      do..smething...
        End If

the problem is


     objNextElement = paraEnum.nextElement();
           xInfo = (XServiceInfo)
UnoRuntime.queryInterface(XServiceInfo.class, objNextElement);
           if (xInfo.supportsService("com.sun.star.text.Paragraph")) {
                   XPropertySet xSet = (XPropertySet)
UnoRuntime.queryInterface(
                           XPropertySet.class, xInfo);
                    Integer nLevel =
(Integer)xSet.getPropertyValue("NumberingLevel");
                    if (nLevel >= 0) {
                        do something...
                      }

I keep getting an unknown property exception for the paragraph
property "NumberingLevel" in java, which appears to be the equivalent
of ParaChapterNumberingLevel....

What am i doing wrong ?

If the property is named "ParaChapterNumberingLevel" when accessed from Basic, it should have the same name when accessed from Java.

Also, the thing returned from xSet.getPropertyValue is a UNO ANY; you cannot directly cast it to a Java Integer, you need to use com.sun.star.uno.AnyConverter instead---see the Developer's Guide.

-Stephan

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to