[users] Re: API to retrieve document metadata
Hello Alona, On Mon, Nov 07, 2011 at 11:50:01AM -0500, Alona Rossen wrote: We found that the attached sample application as well as the application downloadable from http://people.apache.org/~arielch/api/DocumentProperties.zip successfully run on Windows XP Professional workstation, so it worked. Nice to hear that. but do not produce document statistics on Windows server box. Is it an expected observation? no, it isn't. What do you mean by do not produce? Can the application bootstrap OOo? Can the document be loaded? Can the document statistics be retrieved? Notice that the sample applications use the simple bootstrap mechanism, cppu::bootstrap() that bootstraps a local installation. If you want the application to connect to OOo listening on a port, you have to use another bootstrap mechanism. Regards -- Ariel Constenla-Haile La Plata, Argentina pgp7N3BbPvIQj.pgp Description: PGP signature
[users] Re: API to retrieve document metadata
Can the application bootstrap OOo? - YES Can the document be loaded? - YES Can the document statistics be retrieved? - NO -Original Message- From: Ariel Constenla-Haile [mailto:ariel.constenla.ha...@gmail.com] Sent: Monday, November 07, 2011 12:42 PM To: users@openoffice.org Subject: [users] Re: API to retrieve document metadata Hello Alona, On Mon, Nov 07, 2011 at 11:50:01AM -0500, Alona Rossen wrote: We found that the attached sample application as well as the application downloadable from http://people.apache.org/~arielch/api/DocumentProperties.zip successfully run on Windows XP Professional workstation, so it worked. Nice to hear that. but do not produce document statistics on Windows server box. Is it an expected observation? no, it isn't. What do you mean by do not produce? Can the application bootstrap OOo? Can the document be loaded? Can the document statistics be retrieved? Notice that the sample applications use the simple bootstrap mechanism, cppu::bootstrap() that bootstraps a local installation. If you want the application to connect to OOo listening on a port, you have to use another bootstrap mechanism. 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
[users] Re: API to retrieve document metadata
Hi Ariel, Thank you very much. Regards, Alona -Original Message- From: Ariel Constenla Haile [mailto:ariel.constenla.ha...@gmail.com] Sent: Friday, November 04, 2011 3:20 AM To: users@openoffice.org Subject: [users] Re: API to retrieve document metadata On Thu, Nov 03, 2011 at 10:12:44AM -0400, Alona Rossen wrote: Hello Ariel, We access ODF files and we do not modify the files. Attached is a MS Visual Studio 9 project. it took me some work to make this work. I'm curious how you managed to make the project work: it does have any additional include directory, no linker directory, etc. I changed the code a little (among other things, it uses the simple bootstrap mechanism), and the project settings, so that it can be compiled and debugged from with the MS VS 2008 Express IDE. See the attached modified version. The code works fine, so I'm not sure why it didn't work for you (besides the rtl::OUString error I mentioned in the previous mail). I also uploaded a version of my example, now with a VS Project http://people.apache.org/~arielch/api/DocumentProperties.zip Read the file /DocumentProperties/.vsprj/README_VS2008Express for instructions on how to modify the project's settings. Following the instructions there you should be able to build and the run example on the IDE. I'd suggest to ask further question on ooo-...@incubator.apache.org (this is a users list, and is going to be shout down). List information * Writing to the list ooo-...@incubator.apache.org * Subscription addressooo-dev-subscr...@incubator.apache.org * Digest subscription address ooo-dev-digest-subscr...@incubator.apache.org * Unsubscription addressesooo-dev-unsubscr...@incubator.apache.org * Getting help with the list ooo-dev-h...@incubator.apache.org Please tag your post beginning the subject with the [API] tag. 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
[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 pgp8kJbz2O7uY.pgp Description: PGP signature
[users] Re: API to retrieve document metadata
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
[users] Re: API to retrieve document metadata
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. 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]); } } 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 Regards, Alona -Original Message- From: Ariel Constenla-Haile [mailto:ariel.constenla.ha...@gmail.com] Sent: Tuesday, October 25, 2011 6:41 PM To: users@openoffice.org Subject: [users] Re: API to retrieve document metadata Hi Alona, On Mon, Oct 24, 2011 at 04:41:50PM -0400, Alona Rossen wrote: metadata listed under File-Properties-Statistics in OpenOffice (number of pages, paragraph count, word count, etc). I see I didn't include those in the example. See the version I attach now. 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
[users] Re: API to retrieve document metadata
Hi Ariel, Thank you. We were able to retrieve some metadata with your help. - Alona -Original Message- From: Ariel Constenla-Haile [mailto:ariel.constenla.ha...@gmail.com] Sent: Tuesday, October 25, 2011 6:41 PM To: users@openoffice.org Subject: [users] Re: API to retrieve document metadata Hi Alona, On Mon, Oct 24, 2011 at 04:41:50PM -0400, Alona Rossen wrote: metadata listed under File-Properties-Statistics in OpenOffice (number of pages, paragraph count, word count, etc). I see I didn't include those in the example. See the version I attach now. 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
[users] Re: API to retrieve document metadata
I have no intention to unsubscribe. Please respond to my question regarding API to retrieve document metadata. From: biddi...@aol.com [mailto:biddi...@aol.com] Sent: Monday, October 24, 2011 8:06 PM To: users@openoffice.org Subject: [users] Re: API to retrieve document metadata unsubscribe In a message dated 10/24/2011 4:43:08 P.M. Eastern Daylight Time, aros...@opentext.com writes: Hi All, Please suggest OOo API to retrieve document metadata. For example, metadata listed under File-Properties-Statistics in OpenOffice (number of pages, paragraph count, word count, etc). Thank you, Alona = -- - To unsubscribe send email to users-unsubscr...@openoffice.org For additional commands send email to sy...@openoffice.org with Subject: help
[users] Re: API to retrieve document metadata
On 25/10/11 15:00, Alona Rossen wrote: I have no intention to unsubscribe. Please respond to my question regarding API to retrieve document metadata. I doubt pleas in that direction will help. I don't know if http://netcologne.dl.sourceforge.net/project/metadata-tools/metadata-tools/Metadata-Tools_0.5_Beta/MetaData-Tools_0-5_Beta.zip (beware line wrap) will be of any help. I just googled for 'openoffice metadata api' and that turned up. -- Mike Scott Harlow, Essex, England -- - To unsubscribe send email to users-unsubscr...@openoffice.org For additional commands send email to sy...@openoffice.org with Subject: help
[users] Re: API to retrieve document metadata
Hi Alona, On Mon, Oct 24, 2011 at 04:41:50PM -0400, Alona Rossen wrote: Please suggest OOo API to retrieve document metadata. For example, metadata listed under File-Properties-Statistics in OpenOffice (number of pages, paragraph count, word count, etc). every document implements com.sun.star.document.XDocumentPropertiesSupplier http://api.openoffice.org/docs/common/ref/com/sun/star/document/XDocumentPropertiesSupplier.html getDocumentProperties() returns an css.document.XDocumentProperties http://api.openoffice.org/docs/common/ref/com/sun/star/document/XDocumentProperties.html In OOo Basic: Sub Main Dim oDoc as Object oDoc = ThisComponent Dim oDocProps as Object oDocProps = oDoc.getDocumentProperties() End Sub Inspect oDocProps in the OOo Basic IDE. Regards -- Ariel Constenla-Haile La Plata, Argentina pgp8SGOQJlyli.pgp Description: PGP signature
[users] Re: API to retrieve document metadata
Hi Ariel, Could you please provide a C++ example of how to access getDocumentProperties() method after the document has been loaded? In other words, we cannot understand how to bridge between xComponent, which we get after document is loaded and getDocumentProperties(). Thank you, Alona -Original Message- From: Ariel Constenla-Haile [mailto:ariel.constenla.ha...@gmail.com] Sent: Tuesday, October 25, 2011 10:20 AM To: users@openoffice.org Subject: [users] Re: API to retrieve document metadata Hi Alona, On Mon, Oct 24, 2011 at 04:41:50PM -0400, Alona Rossen wrote: Please suggest OOo API to retrieve document metadata. For example, metadata listed under File-Properties-Statistics in OpenOffice (number of pages, paragraph count, word count, etc). every document implements com.sun.star.document.XDocumentPropertiesSupplier http://api.openoffice.org/docs/common/ref/com/sun/star/document/XDocumen tPropertiesSupplier.html getDocumentProperties() returns an css.document.XDocumentProperties http://api.openoffice.org/docs/common/ref/com/sun/star/document/XDocumen tProperties.html In OOo Basic: Sub Main Dim oDoc as Object oDoc = ThisComponent Dim oDocProps as Object oDocProps = oDoc.getDocumentProperties() End Sub Inspect oDocProps in the OOo Basic IDE. 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
[users] Re: API to retrieve document metadata
Hi Alona, On Tue, Oct 25, 2011 at 11:12:42AM -0400, Alona Rossen wrote: Hi Ariel, Could you please provide a C++ example of how to access getDocumentProperties() method after the document has been loaded? In other words, we cannot understand how to bridge between xComponent, which we get after document is loaded and getDocumentProperties(). when you load a document you get a css.lang.XComponent. Depending on the document you loaded, this document implements different interfaces. The interfaces a document supports are documented in the document service: * a Writer document is documented in the service css.text.TextDocument http://api.openoffice.org/docs/common/ref/com/sun/star/text/TextDocument.html This service includes css.text.GenericTextDocument http://api.openoffice.org/docs/common/ref/com/sun/star/text/GenericTextDocument.html This service includes css.document.OfficeDocument http://api.openoffice.org/docs/common/ref/com/sun/star/document/OfficeDocument.html You can see there all the interfaces an OfficeDocument implements To get an interface from an object (your xComponent here), just query for it: css::uno::Reference SOME_INTERFACE xInterface( xComponent, css::uno::QUERY); if ( xInterface.is() ) { // here do your job } You can do the same research for all other OOo documents: * a Draw document * a Presentation * etc See the attached example. Regards -- Ariel Constenla-Haile La Plata, Argentina #define C2U( constAsciiStr ) \ ( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( constAsciiStr ) ) ) #define U2C( ouString ) \ ( ::rtl::OUStringToOString( ouString, RTL_TEXTENCODING_UTF8 ).getStr() ) // - #include vector #include iostream #include cstdio #include osl/file.hxx #include cppuhelper/bootstrap.hxx #include com/sun/star/beans/PropertyValue.hpp #include com/sun/star/document/XDocumentPropertiesSupplier.hpp #include com/sun/star/frame/XComponentLoader.hpp #include com/sun/star/frame/FrameSearchFlag.hpp #include com/sun/star/uno/Reference.h #include com/sun/star/uno/XComponentContext.hpp using namespace ::com::sun::star; int SAL_CALL main ( const int argc, const char* argv[] ) { int ret = 0; if ( argc != 2 ) { std::cerr Usage: std::endl argv[0] DOC_TO_LOAD std::endl wherestd::endl DOC_TO_LOAD is the system path of the document to load std::endl; return 1; } rtl::OUString path = rtl::OUString::createFromAscii( argv[1] ); rtl::OUString path_url; if ( osl_File_E_None != osl_getFileURLFromSystemPath( path.pData, path_url.pData ) ) { std::cerr Can not convert argv[1] to URL. std::endl; return 1; } try { uno::Reference uno::XComponentContext rxContext ( ::cppu::bootstrap() ); uno::Reference frame::XComponentLoader rxComponentLoader( rxContext-getServiceManager()-createInstanceWithContext( C2U( com.sun.star.frame.Desktop ), rxContext ), uno::UNO_QUERY ); uno::Reference lang::XComponent xComponent = rxComponentLoader-loadComponentFromURL( path_url, C2U( _default ), frame::FrameSearchFlag::ALL, uno::Sequence beans::PropertyValue () ); uno::Reference document::XDocumentPropertiesSupplier xDocPropsSup( xComponent, uno::UNO_QUERY ); if ( !xDocPropsSup.is() ) { std::cerr No Document Props. Supplier! std::endl; return 1; } uno::Reference document::XDocumentProperties xDocProps = xDocPropsSup-getDocumentProperties(); if ( !xDocProps.is() ) { std::cerr No Document Properties! std::endl; return 1; } // Attributes rtl::OUString Title= xDocProps-getTitle(); rtl::OUString Subject = xDocProps-getSubject(); rtl::OUString Description = xDocProps-getDescription(); rtl::OUString Generator= xDocProps-getGenerator(); rtl::OUString Author = xDocProps-getAuthor(); util::DateTime CreationDate = xDocProps-getCreationDate(); rtl::OUString ModifiedBy= xDocProps-getModifiedBy(); util::DateTime ModificationDate = xDocProps-getModificationDate(); uno::Sequence ::rtl::OUString Keywords = xDocProps-getKeywords(); lang::Locale Language = xDocProps-getLanguage(); rtl::OUString PrintedBy = xDocProps-getPrintedBy(); util::DateTime PrintDate = xDocProps-getPrintDate(); rtl::OUString TemplateName = xDocProps-getTemplateName(); rtl::OUString TemplateURL = xDocProps-getTemplateURL(); util::DateTime TemplateDate =
[users] Re: API to retrieve document metadata
When you subscribed, you received a message that told you how to unsubscribe. It asked you to keep this message in case you wanted to unsubscribe. You must do the unsubscribing yourself. There are instructions how to unsubscribe at the bottom of each email message you receive from this list. This is done to prevent subscribing or unsubscribing by anyone other than the recipient. I repeat that information below for your benefit. Further I explain: To unsubscribe, send an email message to the address below. The subject and body of this message are ignored. When the message is received by the email robot, there will be an email message containing a request for confirmation to which you must reply to complete unsubscribing. David B Teague -- - *To unsubscribe send email to users-unsubscr...@openoffice.org *For additional commands send email tosy...@openoffice.org with Subject: help On 10/24/2011 8:06 PM, biddi...@aol.com wrote: unsubscribe In a message dated 10/24/2011 4:43:08 P.M. Eastern Daylight Time, aros...@opentext.com writes: Hi All, Please suggest OOo API to retrieve document metadata. For example, metadata listed under File-Properties-Statistics in OpenOffice (number of pages, paragraph count, word count, etc). Thank you, Alona = -- nil significat nisi oscillat -- - To unsubscribe send email to users-unsubscr...@openoffice.org For additional commands send email to sy...@openoffice.org with Subject: help
[users] Re: API to retrieve document metadata
I have no intention to unsubscribe. Please reply in the correct thread. From: David B Teague sr [mailto:davidbtea...@comporium.net] Sent: Tuesday, October 25, 2011 2:17 PM To: users@openoffice.org Cc: biddi...@aol.com Subject: [users] Re: API to retrieve document metadata When you subscribed, you received a message that told you how to unsubscribe. It asked you to keep this message in case you wanted to unsubscribe. You must do the unsubscribing yourself. There are instructions how to unsubscribe at the bottom of each email message you receive from this list. This is done to prevent subscribing or unsubscribing by anyone other than the recipient. I repeat that information below for your benefit. Further I explain: To unsubscribe, send an email message to the address below. The subject and body of this message are ignored. When the message is received by the email robot, there will be an email message containing a request for confirmation to which you must reply to complete unsubscribing. David B Teague -- - To unsubscribe send email to users-unsubscr...@openoffice.org For additional commands send email to sy...@openoffice.org with Subject: help On 10/24/2011 8:06 PM, biddi...@aol.com wrote: unsubscribe In a message dated 10/24/2011 4:43:08 P.M. Eastern Daylight Time, aros...@opentext.com writes: Hi All, Please suggest OOo API to retrieve document metadata. For example, metadata listed under File-Properties-Statistics in OpenOffice (number of pages, paragraph count, word count, etc). Thank you, Alona = -- nil significat nisi oscillat -- - To unsubscribe send email to users-unsubscr...@openoffice.org For additional commands send email to sy...@openoffice.org with Subject: help
[users] Re: API to retrieve document metadata
In a message dated 10/24/2011 8:07:13 P.M. Eastern Daylight Time, biddi...@aol.com writes: unsubscribe In a message dated 10/24/2011 4:43:08 P.M. Eastern Daylight Time, aros...@opentext.com writes: Hi All, Please suggest OOo API to retrieve document metadata. For example, metadata listed under File-Properties-Statistics in OpenOffice (number of pages, paragraph count, word count, etc). Thank you, Alona = = -- - To unsubscribe send email to users-unsubscr...@openoffice.org For additional commands send email to sy...@openoffice.org with Subject: help
[users] Re: API to retrieve document metadata
Hi Alona, On Mon, Oct 24, 2011 at 04:41:50PM -0400, Alona Rossen wrote: metadata listed under File-Properties-Statistics in OpenOffice (number of pages, paragraph count, word count, etc). I see I didn't include those in the example. See the version I attach now. Regards -- Ariel Constenla-Haile La Plata, Argentina #define C2U( constAsciiStr ) \ ( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( constAsciiStr ) ) ) #define U2C( ouString ) \ ( ::rtl::OUStringToOString( ouString, RTL_TEXTENCODING_UTF8 ).getStr() ) // - #include vector #include iostream #include cstdio #include osl/file.hxx #include cppuhelper/bootstrap.hxx #include com/sun/star/beans/PropertyValue.hpp #include com/sun/star/document/XDocumentPropertiesSupplier.hpp #include com/sun/star/frame/XComponentLoader.hpp #include com/sun/star/frame/FrameSearchFlag.hpp #include com/sun/star/uno/Reference.h #include com/sun/star/uno/XComponentContext.hpp using namespace ::com::sun::star; int SAL_CALL main ( const int argc, const char* argv[] ) { int ret = 0; if ( argc != 2 ) { std::cerr Usage: std::endl argv[0] DOC_TO_LOAD std::endl wherestd::endl DOC_TO_LOAD is the system path of the document to load std::endl; return 1; } rtl::OUString path = rtl::OUString::createFromAscii( argv[1] ); rtl::OUString path_url; if ( osl_File_E_None != osl_getFileURLFromSystemPath( path.pData, path_url.pData ) ) { std::cerr Can not convert argv[1] to URL. std::endl; return 1; } try { uno::Reference uno::XComponentContext rxContext ( ::cppu::bootstrap() ); uno::Reference frame::XComponentLoader rxComponentLoader( rxContext-getServiceManager()-createInstanceWithContext( C2U( com.sun.star.frame.Desktop ), rxContext ), uno::UNO_QUERY ); uno::Reference lang::XComponent xComponent = rxComponentLoader-loadComponentFromURL( path_url, C2U( _default ), frame::FrameSearchFlag::ALL, uno::Sequence beans::PropertyValue () ); uno::Reference document::XDocumentPropertiesSupplier xDocPropsSup( xComponent, uno::UNO_QUERY ); if ( !xDocPropsSup.is() ) { std::cerr No Document Props. Supplier! std::endl; return 1; } uno::Reference document::XDocumentProperties xDocProps = xDocPropsSup-getDocumentProperties(); if ( !xDocProps.is() ) { std::cerr No Document Properties! std::endl; return 1; } // Attributes rtl::OUString Title= xDocProps-getTitle(); rtl::OUString Subject = xDocProps-getSubject(); rtl::OUString Description = xDocProps-getDescription(); rtl::OUString Generator= xDocProps-getGenerator(); rtl::OUString Author = xDocProps-getAuthor(); util::DateTime CreationDate = xDocProps-getCreationDate(); rtl::OUString ModifiedBy= xDocProps-getModifiedBy(); util::DateTime ModificationDate = xDocProps-getModificationDate(); uno::Sequence ::rtl::OUString Keywords = xDocProps-getKeywords(); lang::Locale Language = xDocProps-getLanguage(); rtl::OUString PrintedBy = xDocProps-getPrintedBy(); util::DateTime PrintDate = xDocProps-getPrintDate(); rtl::OUString TemplateName = xDocProps-getTemplateName(); rtl::OUString TemplateURL = xDocProps-getTemplateURL(); util::DateTime TemplateDate = xDocProps-getTemplateDate(); rtl::OUString AutoloadURL = xDocProps-getAutoloadURL(); sal_Int32 AutoloadSecs = xDocProps-getAutoloadSecs(); rtl::OUString DefaultTarget = xDocProps-getDefaultTarget(); uno::Sequence beans::NamedValue DocumentStatistics = xDocProps-getDocumentStatistics(); sal_Int32 nPageCount, nTableCount, nImageCount, nObjectCount, nParagraphCount, nWordCount, nCharacterCount; nPageCount = nTableCount = nImageCount = nObjectCount = nParagraphCount = nWordCount = nCharacterCount = 0; for ( sal_Int32 n = 0; n DocumentStatistics.getLength(); n++ ) { rtl::OUString sName = DocumentStatistics[n].Name; uno::Any aValue = DocumentStatistics[n].Value; if ( sName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( PageCount ) ) ) aValue = nPageCount; else if ( sName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( TableCount ) ) ) aValue = nTableCount; else if ( sName.equalsAsciiL(
[users] Re: API to retrieve document metadata
unsubscribe In a message dated 10/24/2011 4:43:08 P.M. Eastern Daylight Time, aros...@opentext.com writes: Hi All, Please suggest OOo API to retrieve document metadata. For example, metadata listed under File-Properties-Statistics in OpenOffice (number of pages, paragraph count, word count, etc). Thank you, Alona = -- - To unsubscribe send email to users-unsubscr...@openoffice.org For additional commands send email to sy...@openoffice.org with Subject: help