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

NoSuchElementException when using OO3.0

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


Joined: 18 Aug 2008
Posts: 2

PostPosted: Wed Nov 12, 2008 6:12 am    Post subject: NoSuchElementException when using OO3.0 Reply with quote

Hi,

I have used OO2.2 using the following code to get the basic libraries.

Code:
Any any = (Any)propertySet.getPropertyValue("BasicLibraries");
XLibraryContainer libraryContainer = (XLibraryContainer)UnoRuntime.queryInterface(XLibraryContainer.class, any);
XNameAccess nameAccess = (XNameAccess)UnoRuntime.queryInterface(XNameAccess.class, libraryContainer);
obj = nameAccess.getByName("Standard");


Now i have upgraded to OO3.0, it throws com.sun.star.container.NoSuchElementException while getting the "Standard" library. I have tried to get all the names by getElementNames, it also return empty String array.

Is there any change i need to do for OO3.0?
Back to top
View user's profile Send private message
antony
Newbie
Newbie


Joined: 18 Aug 2008
Posts: 2

PostPosted: Fri Nov 14, 2008 11:13 pm    Post subject: OO3 will not create Standard library for new document Reply with quote

I got the answer Very Happy

I got this exception due to there is no standard library in the XLibraryContainer. We need to create the Standard library using the createLibrary API for the new document.
Code:
try{
 libraryContainer.loadLibrary("Standard");
}catch(com.sun.star.container.NoSuchElementException ex){
 libraryContainer.createLibrary("Standard");
}
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