Christian Lohmaier wrote:
Hi *,

I got some trouble with the DocumentInfo's properties.
file:///opt/openoffice.org2.1_sdk/docs/common/ref/com/sun/star/document/DocumentInfo.html
http://api.openoffice.org/docs/common/ref/com/sun/star/document/DocumentInfo.html

The properties I can query don't match those that are listed in the
reference.
it's often the problem of bad or incomplete documented APIs -> please submit an issue


I originally tried in Java, but I get the same results when using Basic.

Try the following macro:
sub docinfoprops()
  Dim props() as Variant
  oDoc = ThisComponent
  oText = oDoc.getText()

  xprops = oDoc.getDocumentInfo()
  xpsi = xprops.getPropertySetInfo()
  props =  xpsi.getProperties()
for i = 0 To UBound(props)
    oText.InsertString(oCursor, "Prop " & i & " " & props(i).Name , false)
oinspect = xprops.getPropertyValue(props(i).Name) ' can watch this... oText.insertControlCharacter(oCursor, com.sun.star.text.ControlCharacter.PARAGRAPH_BREAK, False)
  next
print "Done"
end sub

You'll get 33 Properties, but not all are listed in the docs, and you don't get
all that are listed in the docs.

(look e.g. for the "Language" property listed in the docs. It is not
available. Instead you got a property "CharLocale")
that is definitely a bug -> please submit a separate issue for the Language property


But the trouble doesn't stop here. Some properties cannot be retrieved.
You get an empty/void object instead.
if you have already identified the missing properties and if they are not deprecated, please submit issues


So while you can use
oText.InsertString(oCursor, ":  " & 
xprops.getPropertyValue("CreationDate").Year , false)

to get the Year-field from the DateTime struct, you cannot use
oText.InsertString(oCursor, ":  " & 
xprops.getPropertyValue("CharLocale").Language , false)
to get the Language field from the Locale struct, since it doesn't
return a struct, but an empty object.

Is the problem my understanding of the whole thing? (please direct me to
my error/show me how I would do this properly)
Is the problem the documentation? Is the problem in the functionality of
the Office?
probably both but you can help to improve it by reporting the problems ;-)

Juergen

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

Reply via email to