Hello Aaron,

On Thursday 09 April 2009, 21:33, Aaron Ehrensberger wrote:
> One additional question...because this is using the Writer implementation,
> that would imply that I cannot use this same code to determine the pages of
> a spreadsheet correct?  Is there no page count property on a generic
> document object?

no, there isn't.

> I found another post that led me towards Document Properties...but in doing
> that code, I'm returning a null on the properties.  My code for that is as
> follows...
>
>
> XComponent document = xComponentLoader.loadComponentFromURL(docURL,
> "_blank", 0, loaderValues);
>
> XDocumentPropertiesSupplier xdis =
> (XDocumentPropertiesSupplier)UnoRuntime.queryInterface(XDocumentPropertiesS
>upplier.class, document);

the following is wrong:

> XDocumentProperties xProps = (XDocumentProperties)
> UnoRuntime.queryInterface(XDocumentProperties.class, xdis);

use XDocumentPropertiesSupplier.getDocumentProperties() to access the 
XDocumentProperties

see 
http://api.openoffice.org/docs/common/ref/com/sun/star/document/XDocumentPropertiesSupplier.html

> NamedValue[] stats = xProps.getDocumentStatistics();
>
> for (int i=0; i<stats.length; i++) {
>    NamedValue stat = stats[i];
>    if ("PageCount".equalsIgnoreCase(stat.Name)) {
>        System.out.println("stat value is " + stat.Value);
>        long pageCount = ((Long) stat.Value).longValue();
>    }
> }
>
> I'm going to hook up your suggestions and test it out across document
> types, 

"PageCount" is a property of Writer's controller impl. only, so won't work 
with other document's type.


Regards
-- 
Ariel Constenla-Haile
La Plata, Argentina

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to