On Thu, Nov 3, 2011 at 10:12 AM, Alona Rossen <aros...@opentext.com> wrote:
> Hello Ariel,
>
>
> We access ODF files and we do not modify the files.
>

Another approach is to use the ODF Toolkit.  This is another Apache
incubation project.  It uses Java to manipulate ODF documents.  It
does not require OpenOffice.  It operates directly on the file format.

See this page for some examples of how easy it is to use for accessing
document metadata:

http://incubator.apache.org/odftoolkit/simple/document/cookbook/Manipulate%20Metadata.html#Access%20metadata

Of course, this is only easy if you use Java ;-)

-Rob

> Attached is a MS Visual Studio 9 project.
>
>
> Regards,
> Alona
>
> -----Original Message-----
> From: Ariel Constenla-Haile [mailto:ariel.constenla.ha...@gmail.com]
> Sent: Thursday, November 03, 2011 5:50 AM
> To: users@openoffice.org
> Subject: [users] Re: API to retrieve document metadata
>
> 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
> --
> -----------------------------------------------------------------
> To unsubscribe send email to users-unsubscr...@openoffice.org
> For additional commands send email to sy...@openoffice.org
> with Subject: help
>
-- 
-----------------------------------------------------------------
To unsubscribe send email to users-unsubscr...@openoffice.org
For additional commands send email to sy...@openoffice.org
with Subject: help

Reply via email to