OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

HowTo get Document Properties from Calc, Impress, PDF [Java]

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API
View previous topic :: View next topic  
Author Message
a_cooper
General User
General User


Joined: 06 May 2008
Posts: 11

PostPosted: Wed May 07, 2008 2:00 pm    Post subject: HowTo get Document Properties from Calc, Impress, PDF [Java] Reply with quote

OpenOffice.org 2.4.0, running on XP Pro, Java 1.6

I am trying to read the document properties (title, subject, author, keywords) from Word, Excel, PowerPoint and PDF documents using a Java program that utilitizes the OOo libraries.

I have successfully been able to get the doc properties from a MS Word file. However, I have hit a roadblock with Excel and haven't attempted PowerPoint or PDF yet. I am getting a nullPointerException when I call the getDocumentInfo() method on the object of type XDocumentInfoSupplier.

Here is the offending code. A valid XSpreadsheetDocument is being passed into the function:
Code:

private XPropertySet getDocumentProperties(XSpreadsheetDocument theDoc) {
   XDocumentInfoSupplier xDocumentInfo = (XDocumentInfoSupplier) UnoRuntime.queryInterface(XDocumentInfoSupplier.class, theDoc);
   Object oDocumentInfo = xDocumentInfo.getDocumentInfo();   // throws Null Pointer here!
   XPropertySet pDocumentInfo = (XPropertySet)UnoRunTime.queryInterface(XPropertySet.class, oDocumentInfo);  // never gets here
   return pDocumentInfo;
}


Thanks for looking and thanks for any help you can give.
Back to top
View user's profile Send private message
ayce
General User
General User


Joined: 27 Nov 2009
Posts: 14

PostPosted: Tue Mar 16, 2010 3:51 am    Post subject: Reply with quote

Maybe this will help you:

Code:
XDocumentInfoSupplier xDocInfoSup = (XDocumentInfoSupplier) UnoRuntime.queryInterface(XDocumentInfoSupplier.class,  m_xFrame.getController().getModel());
                    XDocumentInfo xDocInfo = xDocInfoSup.getDocumentInfo();


greetz
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group