ashok _ wrote:
I am trying set the SectionLeftMargin property of an XTextSection.... :
xPropSet.setPropertyValue("SectionLeftMargin", new Long(762));
The above raises an IllegalArgumentException...
The section document describes the SectionLeftMargin property as a
"long" datatype..
http://api.openoffice.org/docs/common/ref/com/sun/star/text/TextSection.html#SectionLeftMargin
The following works without raising exceptions :
xPropSet.setPropertyValue("SectionLeftMargin", new Integer(762));
When I view the section properties using XRay, SectionLeftMargin is
indicated as a "long" type again...
so its not the case of the documentation being wrong..
Is this a bug or am I reading the documentation wrong ?
(Java 1.5, Openoffice 2.3.1 , Windows xp... )
Be careful here: the UNO datatypes are rooted way in the past and in
another language (C++), where the length of an int (and of a long) was
defined by width of the processor's register (and later got carved in
stone). In order to map an "UNO long" to the respective Java datatype
you need to lookup the mapping table which would show that it is an
"int" resp. "java.lang.Integer".
[There should be such a table in the OpenOffice Wiki, which I do not
have handy. Instead, you could also look up the following two-page
reference card for ooRexx which uses the Java APIs and as such has a
mapping table on page two showing how the UNO datatypes map to the Java
ones.]
HTH,
---rony
P.S.: Here's a listing of <com.sun.star.text.TextSection> from a
student's (Nicole Scholz) work in progress, giving an overview of all
members of the service and listing the Java datatypes for properties:
*[com.sun.star.text.TextSection
<http://api.openoffice.org/docs/common/ref/com/sun/star/text/TextSection>
[xref]
<http://api.openoffice.org/docs/common/ref/com/sun/star/text/TextSection-xref.html>]
(UNO_SERVICE)*
*Member Name*
*Type*
1 BackGraphicFilter <java.lang.String>
<http://api.openoffice.org/docs/common/ref/com/sun/star/text/TextSection.html#BackGraphicFilter>
UNO_PROPERTY
2 BackGraphicLocation <com.sun.star.style.GraphicLocation>
<http://api.openoffice.org/docs/common/ref/com/sun/star/text/TextSection.html#BackGraphicLocation>
UNO_PROPERTY
3 BackGraphicURL <java.lang.String>
<http://api.openoffice.org/docs/common/ref/com/sun/star/text/TextSection.html#BackGraphicURL>
UNO_PROPERTY
4 Condition <java.lang.String>
<http://api.openoffice.org/docs/common/ref/com/sun/star/text/TextSection.html#Condition>
UNO_PROPERTY
5 DDECommandElement <java.lang.String>
<http://api.openoffice.org/docs/common/ref/com/sun/star/text/TextSection.html#DDECommandElement>
UNO_PROPERTY
6 DDECommandFile <java.lang.String>
<http://api.openoffice.org/docs/common/ref/com/sun/star/text/TextSection.html#DDECommandFile>
UNO_PROPERTY
7 DDECommandType <java.lang.String>
<http://api.openoffice.org/docs/common/ref/com/sun/star/text/TextSection.html#DDECommandType>
UNO_PROPERTY
8 EndnoteIsCollectAtTextEnd <java.lang.Boolean>
<http://api.openoffice.org/docs/common/ref/com/sun/star/text/TextSection.html#EndnoteIsCollectAtTextEnd>
UNO_PROPERTY
9 EndnoteIsOwnNumbering <java.lang.Boolean>
<http://api.openoffice.org/docs/common/ref/com/sun/star/text/TextSection.html#EndnoteIsOwnNumbering>
UNO_PROPERTY
10 EndnoteIsRestartNumbering <java.lang.Boolean>
<http://api.openoffice.org/docs/common/ref/com/sun/star/text/TextSection.html#EndnoteIsRestartNumbering>
UNO_PROPERTY
11 EndnoteNumberingPrefix <java.lang.String>
<http://api.openoffice.org/docs/common/ref/com/sun/star/text/TextSection.html#EndnoteNumberingPrefix>
UNO_PROPERTY
12 EndnoteNumberingSuffix <java.lang.String>
<http://api.openoffice.org/docs/common/ref/com/sun/star/text/TextSection.html#EndnoteNumberingSuffix>
UNO_PROPERTY
13 EndnoteNumberingType <java.lang.Short>
<http://api.openoffice.org/docs/common/ref/com/sun/star/text/TextSection.html#EndnoteNumberingType>
UNO_PROPERTY
14 EndnoteRestartNumberingAt <java.lang.Short>
<http://api.openoffice.org/docs/common/ref/com/sun/star/text/TextSection.html#EndnoteRestartNumberingAt>
UNO_PROPERTY
15 FileLink <com.sun.star.text.SectionFileLink>
<http://api.openoffice.org/docs/common/ref/com/sun/star/text/TextSection.html#FileLink>
UNO_PROPERTY
16 FootnoteIsCollectAtTextEnd <java.lang.Boolean>
<http://api.openoffice.org/docs/common/ref/com/sun/star/text/TextSection.html#FootnoteIsCollectAtTextEnd>
UNO_PROPERTY
17 FootnoteIsOwnNumbering <java.lang.Boolean>
<http://api.openoffice.org/docs/common/ref/com/sun/star/text/TextSection.html#FootnoteIsOwnNumbering>
UNO_PROPERTY
18 FootnoteIsRestartNumbering <java.lang.Boolean>
<http://api.openoffice.org/docs/common/ref/com/sun/star/text/TextSection.html#FootnoteIsRestartNumbering>
UNO_PROPERTY
19 FootnoteNumberingPrefix <java.lang.String>
<http://api.openoffice.org/docs/common/ref/com/sun/star/text/TextSection.html#FootnoteNumberingPrefix>
UNO_PROPERTY
20 FootnoteNumberingSuffix <java.lang.String>
<http://api.openoffice.org/docs/common/ref/com/sun/star/text/TextSection.html#FootnoteNumberingSuffix>
UNO_PROPERTY
21 FootnoteNumberingType <java.lang.Short>
<http://api.openoffice.org/docs/common/ref/com/sun/star/text/TextSection.html#FootnoteNumberingType>
UNO_PROPERTY
22 FootnoteRestartNumberingAt <java.lang.Short>
<http://api.openoffice.org/docs/common/ref/com/sun/star/text/TextSection.html#FootnoteRestartNumberingAt>
UNO_PROPERTY
23 IsAutomaticUpdate <java.lang.Boolean>
<http://api.openoffice.org/docs/common/ref/com/sun/star/text/TextSection.html#IsAutomaticUpdate>
UNO_PROPERTY
24 IsProtected <java.lang.Boolean>
<http://api.openoffice.org/docs/common/ref/com/sun/star/text/TextSection.html#IsProtected>
UNO_PROPERTY
25 IsVisible <java.lang.Boolean>
<http://api.openoffice.org/docs/common/ref/com/sun/star/text/TextSection.html#IsVisible>
UNO_PROPERTY
26 LinkRegion <java.lang.String>
<http://api.openoffice.org/docs/common/ref/com/sun/star/text/TextSection.html#LinkRegion>
UNO_PROPERTY
27 SectionLeftMargin <java.lang.Integer>
<http://api.openoffice.org/docs/common/ref/com/sun/star/text/TextSection.html#SectionLeftMargin>
UNO_PROPERTY
28 SectionRightMargin <java.lang.Integer>
<http://api.openoffice.org/docs/common/ref/com/sun/star/text/TextSection.html#SectionRightMargin>
UNO_PROPERTY
29 TextColumns <com.sun.star.text.XTextColumns>
<http://api.openoffice.org/docs/common/ref/com/sun/star/text/TextSection.html#TextColumns>
UNO_PROPERTY
30 XNamed (com.sun.star.container)
<http://api.openoffice.org/docs/common/ref/com/sun/star/text/TextSection.html#XNamed>
UNO_INTERFACE
31 XPropertySet (com.sun.star.beans)
<http://api.openoffice.org/docs/common/ref/com/sun/star/text/TextSection.html#XPropertySet>
UNO_INTERFACE
32 XPropertyState (com.sun.star.beans)
<http://api.openoffice.org/docs/common/ref/com/sun/star/text/TextSection.html#XPropertyState>
UNO_INTERFACE
33 XTextSection (com.sun.star.text)
<http://api.openoffice.org/docs/common/ref/com/sun/star/text/TextSection.html#XTextSection>
UNO_INTERFACE
*[com.sun.star.text.TextSection
<http://api.openoffice.org/docs/common/ref/com/sun/star/text/TextSection>
[xref]
<http://api.openoffice.org/docs/common/ref/com/sun/star/text/TextSection-xref.html>]
(UNO_SERVICE) by UNO Types*
*Name*
*UNO_INTERFACE:*
1 XNamed (com.sun.star.container)
<http://api.openoffice.org/docs/common/ref/com/sun/star/text/TextSection.html#XNamed>
2 XPropertySet (com.sun.star.beans)
<http://api.openoffice.org/docs/common/ref/com/sun/star/text/TextSection.html#XPropertySet>
3 XPropertyState (com.sun.star.beans)
<http://api.openoffice.org/docs/common/ref/com/sun/star/text/TextSection.html#XPropertyState>
4 XTextSection (com.sun.star.text)
<http://api.openoffice.org/docs/common/ref/com/sun/star/text/TextSection.html#XTextSection>
*UNO_PROPERTY:*
1 BackGraphicFilter <java.lang.String>
<http://api.openoffice.org/docs/common/ref/com/sun/star/text/TextSection.html#BackGraphicFilter>
2 BackGraphicLocation <com.sun.star.style.GraphicLocation>
<http://api.openoffice.org/docs/common/ref/com/sun/star/text/TextSection.html#BackGraphicLocation>
3 BackGraphicURL <java.lang.String>
<http://api.openoffice.org/docs/common/ref/com/sun/star/text/TextSection.html#BackGraphicURL>
4 Condition <java.lang.String>
<http://api.openoffice.org/docs/common/ref/com/sun/star/text/TextSection.html#Condition>
5 DDECommandElement <java.lang.String>
<http://api.openoffice.org/docs/common/ref/com/sun/star/text/TextSection.html#DDECommandElement>
6 DDECommandFile <java.lang.String>
<http://api.openoffice.org/docs/common/ref/com/sun/star/text/TextSection.html#DDECommandFile>
7 DDECommandType <java.lang.String>
<http://api.openoffice.org/docs/common/ref/com/sun/star/text/TextSection.html#DDECommandType>
8 EndnoteIsCollectAtTextEnd <java.lang.Boolean>
<http://api.openoffice.org/docs/common/ref/com/sun/star/text/TextSection.html#EndnoteIsCollectAtTextEnd>
9 EndnoteIsOwnNumbering <java.lang.Boolean>
<http://api.openoffice.org/docs/common/ref/com/sun/star/text/TextSection.html#EndnoteIsOwnNumbering>
10 EndnoteIsRestartNumbering <java.lang.Boolean>
<http://api.openoffice.org/docs/common/ref/com/sun/star/text/TextSection.html#EndnoteIsRestartNumbering>
11 EndnoteNumberingPrefix <java.lang.String>
<http://api.openoffice.org/docs/common/ref/com/sun/star/text/TextSection.html#EndnoteNumberingPrefix>
12 EndnoteNumberingSuffix <java.lang.String>
<http://api.openoffice.org/docs/common/ref/com/sun/star/text/TextSection.html#EndnoteNumberingSuffix>
13 EndnoteNumberingType <java.lang.Short>
<http://api.openoffice.org/docs/common/ref/com/sun/star/text/TextSection.html#EndnoteNumberingType>
14 EndnoteRestartNumberingAt <java.lang.Short>
<http://api.openoffice.org/docs/common/ref/com/sun/star/text/TextSection.html#EndnoteRestartNumberingAt>
15 FileLink <com.sun.star.text.SectionFileLink>
<http://api.openoffice.org/docs/common/ref/com/sun/star/text/TextSection.html#FileLink>
16 FootnoteIsCollectAtTextEnd <java.lang.Boolean>
<http://api.openoffice.org/docs/common/ref/com/sun/star/text/TextSection.html#FootnoteIsCollectAtTextEnd>
17 FootnoteIsOwnNumbering <java.lang.Boolean>
<http://api.openoffice.org/docs/common/ref/com/sun/star/text/TextSection.html#FootnoteIsOwnNumbering>
18 FootnoteIsRestartNumbering <java.lang.Boolean>
<http://api.openoffice.org/docs/common/ref/com/sun/star/text/TextSection.html#FootnoteIsRestartNumbering>
19 FootnoteNumberingPrefix <java.lang.String>
<http://api.openoffice.org/docs/common/ref/com/sun/star/text/TextSection.html#FootnoteNumberingPrefix>
20 FootnoteNumberingSuffix <java.lang.String>
<http://api.openoffice.org/docs/common/ref/com/sun/star/text/TextSection.html#FootnoteNumberingSuffix>
21 FootnoteNumberingType <java.lang.Short>
<http://api.openoffice.org/docs/common/ref/com/sun/star/text/TextSection.html#FootnoteNumberingType>
22 FootnoteRestartNumberingAt <java.lang.Short>
<http://api.openoffice.org/docs/common/ref/com/sun/star/text/TextSection.html#FootnoteRestartNumberingAt>
23 IsAutomaticUpdate <java.lang.Boolean>
<http://api.openoffice.org/docs/common/ref/com/sun/star/text/TextSection.html#IsAutomaticUpdate>
24 IsProtected <java.lang.Boolean>
<http://api.openoffice.org/docs/common/ref/com/sun/star/text/TextSection.html#IsProtected>
25 IsVisible <java.lang.Boolean>
<http://api.openoffice.org/docs/common/ref/com/sun/star/text/TextSection.html#IsVisible>
26 LinkRegion <java.lang.String>
<http://api.openoffice.org/docs/common/ref/com/sun/star/text/TextSection.html#LinkRegion>
27 SectionLeftMargin <java.lang.Integer>
<http://api.openoffice.org/docs/common/ref/com/sun/star/text/TextSection.html#SectionLeftMargin>
(OPTIONAL)
28 SectionRightMargin <java.lang.Integer>
<http://api.openoffice.org/docs/common/ref/com/sun/star/text/TextSection.html#SectionRightMargin>
(OPTIONAL)
29 TextColumns <com.sun.star.text.XTextColumns>
<http://api.openoffice.org/docs/common/ref/com/sun/star/text/TextSection.html#TextColumns>