Hello Alona,

On Wed, Nov 02, 2011 at 04:39:29PM -0400, Alona Rossen wrote:
> Hi Ariel, 
> 
> We created an ran the test application following your advice.
> 
> We found that xDocProps->getKeywords() and
> xDocProps->getDocumentStatistics() return empty sequences although OO
> documents do have properties viewable via OO GUI.

are you working with ODF files or with MSOffice files?
Are you just loading the document and getting the doc. properties, or
are you getting them after you have done some changes?
In the later case, you have to refresh the document to get the actual
statistics in the document properties.

> 
> try
>       {
>               Sequence< OUString > aSNL = xDocProps->getKeywords();
>               printf("Keywords:\n");
>               OUString format(RTL_CONSTASCII_USTRINGPARAM(" %s\n"));
>               for( sal_Int32 i = 0; i < aSNL.getLength(); i++ )
>               {
>                       wprintf(format.getStr(),aSNL[i]);

this cannot work: aSNL[i] is an rtl::OUString instance, not a NULL
terminated character array. Look at the U2C macro in my example for
a way to convert the rtl::OUString.

>               }
>       }
> 
> aSNL.getLength() returns 0
> 
> 
> try
>       {
>               Sequence< ::com::sun::star::beans::NamedValue > aNV =
> xDocProps->getDocumentStatistics();
>               printf("DocumentStatistics:\n");
>               OUString format(RTL_CONSTASCII_USTRINGPARAM("%s:
> %s\n"));
>               for( sal_Int32 i = 0; i < aNV.getLength(); i++ )
>               {
>                       //some code goes here
>               }
> 
> aNV.getLength() returns 0
 
this is strange, if you're working with OOo Writer documents.

If you have set up the OOo SDK environment properly, you may try the
following example 

http://people.apache.org/~arielch/api/DocumentProperties/

It has a Makefile and a sample document. You can modify the Makefile to
load the document you are using in your tests, and compare the output of
this program with yours. Simply replace in the Makefile 

TEST_DOC = DocumentProperties.odt

with the name of your document, and place the document inside that
folder.
I tested the example both on Win (MS VS 2008 Express) and Linux.
You will need an OOo 3.3 SDK because the example uses css.util.Duration,
introduced in that version. If you have an earlier OOo SDK, you can
adapt the code to make it compile.

Regards
-- 
Ariel Constenla-Haile
La Plata, Argentina

Attachment: pgp8kJbz2O7uY.pgp
Description: PGP signature

Reply via email to