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

problems with XComponentLoader.loadComponentFromURL()

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


Joined: 30 Jan 2004
Posts: 11
Location: Turin - Italy

PostPosted: Tue Feb 03, 2004 9:07 am    Post subject: problems with XComponentLoader.loadComponentFromURL() Reply with quote

Hi all!

I've got a strange problem when using the Java API call XComponentLoader.loadComponentFromURL().

This method should open a component and return a reference to it (interface XComponent). The document type (and thus the filter to use) should be determined automatically. This works fine for Star/OpenOffice XML documents and for MS Word 97 documents.

But I'm having problems with other document types. I'm trying to load a flat XML document. It does perfectly work when I do it manually (Open -> and then browsing the file system), thus the type detection does work.

If I use the API call instead the document is not loaded and the return value is NULL (without any exception, thus I don't know what's the problem). It does not even work if I specify the type (writer_Flat_XML_File) and the filter name (Flat XML File) as property values for the loadComponentFromURL() method!

There is one special case in which it, however, does work: If I open the XML document manually and then start the program that uses the API. The loadCompnentFromURL() method realizes that the component is already loaded (because the target frame name is "_default") and just returns the reference to it. Of course this is not what I want, it doesn't make any sense to be required to open it "by hand" first.

As I already mentioned the same program works well for Word docs and Star/OpenOffice native documents.

Any hints? It's probably some stupid fault of mine, but I don't have any idea about what I'm doing wrong. I hope that oyu can help me ...

Thanks in advance!

Faust
_________________
"To define means to limit" (Oscar Wilde)
Back to top
View user's profile Send private message
DannyB
Moderator
Moderator


Joined: 02 Apr 2003
Posts: 3991
Location: Lawrence, Kansas, USA

PostPosted: Tue Feb 03, 2004 9:24 am    Post subject: Reply with quote

That is an interesting problem. And you described it well.

Here is one thought I had while reading your message.

Did you install some add on component to be capable of reading the flat XML format? If so, could the installation of this be into your "user" folder rather than the "share" folder? If so, then when the Java program starts up OOo and accesses it, the registry that OOo is using might not see the necessary filter services and type detection registrations, and thus could not load the document. But when you start OOo as a user, yourself, OOo starts with an augmented registry and configuration that has the necessary service implementations registered, and the necessary Type Detection configured.

Am I on the right track? Or can you eliminate this theory?
_________________
Want to make OOo Drawings like the colored flower design to the left?
Back to top
View user's profile Send private message
Faust
General User
General User


Joined: 30 Jan 2004
Posts: 11
Location: Turin - Italy

PostPosted: Wed Feb 04, 2004 1:32 am    Post subject: the filter is configured ... Reply with quote

Thanks for your interest DannyB, but unfortunately I can eliminate your theory ...
I even checked which types and filters are known (using the configuration mangagement, I let my program write the entire list of types and filters to the standard output, both type and filter are present!).

By the way ... Im having the same problem with MS Excel documents ... which does make things even stranger ... ;o)
The flat XML filter is part of OOo. Try getting a list of all types and filters via API, you'll be
surprised how many there are ... ;o)

The problem remains to be strange ...

Anyway, thanks for help!

Greeting from Bella Italia.

Faust
_________________
"To define means to limit" (Oscar Wilde)
Back to top
View user's profile Send private message
Calambo
General User
General User


Joined: 06 Jan 2004
Posts: 31
Location: Paris

PostPosted: Wed Feb 04, 2004 2:27 am    Post subject: Reply with quote

Hello.

I haven't any theory about your problem, but it should work.
I use the Java API to open Excel files, and i never had your problem. It works fine for me.
Back to top
View user's profile Send private message
Faust
General User
General User


Joined: 30 Jan 2004
Posts: 11
Location: Turin - Italy

PostPosted: Wed Feb 04, 2004 3:25 am    Post subject: any specific property values? Reply with quote

Hi Calambo!

Which property values do you use to open Excel files via API? Or do you use any particular search flag? Maybe I just have a problem with my OOo or SDK installation or configuration, that might explain my strange problems ...

Faust
_________________
"To define means to limit" (Oscar Wilde)
Back to top
View user's profile Send private message
Faust
General User
General User


Joined: 30 Jan 2004
Posts: 11
Location: Turin - Italy

PostPosted: Wed Feb 04, 2004 5:46 am    Post subject: Problem resovled ... Reply with quote

Well ... as I already suspected I missed something fundamental ... the filter I wanted to use requires the property value FilterOptions, ALTHOUGH default values are defined ...
It does work now ...

Thanks anyway,

Faust
_________________
"To define means to limit" (Oscar Wilde)
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