Home » Developer & Programmer » Forms » Generate OpenOffice document with CLIENT_OLE2 (10g)
Generate OpenOffice document with CLIENT_OLE2 [message #361453] Wed, 26 November 2008 08:39 Go to next message
joelhc
Messages: 3
Registered: November 2008
Junior Member
Hi,

I want to generate .odt text documents and .ods spreadsheets using CLIENT_OLE2 (Forms 10.1.2.2.0).

I haven't found anything about this. Only a little bit of code that doesnt' work.
Now I'm trying with the code below but it doesn't work.
PROCEDURE create doc IS  
xlApp client_OLE2.OBJ_TYPE;
xframe client_OLE2.OBJ_TYPE;
xlSheets client_OLE2.OBJ_TYPE;
xaux client_OLE2.OBJ_TYPE;
arg_list client_OLE2.LIST_TYPE;
arg_list2 client_OLE2.LIST_TYPE;
xarg client_OLE2.LIST_TYPE;

BEGIN
--xlApp := OLE2.CREATE_OBJ( 'com.sun.star.servicemanager');
xlApp := client_OLE2.CREATE_OBJ('com.sun.star.ServiceManager');
arg_list := client_OLE2.CREATE_ARGLIST;
client_ole2.add_arg(arg_list,'com.sun.star.frame.Desktop');
xframe := client_OLE2.INVOKE_OBJ(xlApp,'createInstance',arg_list);
--xaux := client_OLE2.INVOKE_OBJ(xlApp,'createInstance',arg_list);
arg_list2 := client_OLE2.CREATE_ARGLIST;
client_ole2.add_arg(arg_list2,'private:factory/swriter');
client_ole2.add_arg(arg_list2,'_blank');
client_ole2.add_arg(arg_list2,0);
client_ole2.add_arg(arg_list2,xarg);
xlSheets := client_OLE2.INVOKE_OBJ(xframe,'loadComponentFromURL',arg_list2);
end;


Can someone help me? Thanks in advance,

Joel
Re: Generate OpenOffice document with CLIENT_OLE2 [message #361573 is a reply to message #361453] Thu, 27 November 2008 00:57 Go to previous messageGo to next message
djmartin
Messages: 10180
Registered: March 2005
Location: Canberra ACT Australia
Senior Member
Account Moderator
What does "it doesn't work" mean? It doesn't compile, doesn't generate, doesn't run? Do you get an error message? Does it fail at a particular line?

Search this forum for 'client_ole'. There are many threads concerning the use of 'ole2' and 'client_ole2'.

David
Re: Generate OpenOffice document with CLIENT_OLE2 [message #361590 is a reply to message #361573] Thu, 27 November 2008 02:00 Go to previous messageGo to next message
joelhc
Messages: 3
Registered: November 2008
Junior Member
Hi,

Thanks for the reply.

The code compiles well but in the execution appears this error
Error: 100501: non-Oracle exception
.

I think the problem is in the last line
xlSheets := client_OLE2.INVOKE_OBJ(xframe,'loadComponentFromURL',arg_list2);

because if I comment it, the execution doesn't fail (although nothing happens).

Of course, I've searched in this forum and in the rest of the net about this but I haven't found anything. All the documentation is to generate a excel or word document.

To solve the .ods spreadsheet problem, as a temporal solution, I'm going to create XML text file and then open (client_host) with Lotus Symphony.

But for the .odt document....I don't know!!

Joel
Re: Generate OpenOffice document with CLIENT_OLE2 [message #361737 is a reply to message #361590] Thu, 27 November 2008 18:42 Go to previous messageGo to next message
djmartin
Messages: 10180
Registered: March 2005
Location: Canberra ACT Australia
Senior Member
Account Moderator
Put 'message; pause;' pairs between EVERY line of code and prove which statement is failing.

David
Re: Generate OpenOffice document with CLIENT_OLE2 [message #361810 is a reply to message #361737] Fri, 28 November 2008 02:30 Go to previous messageGo to next message
joelhc
Messages: 3
Registered: November 2008
Junior Member
Hi,
it fails here:
xlSheets := client_OLE2.INVOKE_OBJ(xframe,'loadComponentFromURL',arg_list2);

Thanks,

Joel
Re: Generate OpenOffice document with CLIENT_OLE2 [message #362355 is a reply to message #361810] Tue, 02 December 2008 00:45 Go to previous message
djmartin
Messages: 10180
Registered: March 2005
Location: Canberra ACT Australia
Senior Member
Account Moderator
I don't understand '0' as argument three and I don't like 'xarg' as argument four.

I had a look at http://api.openoffice.org/docs/common/ref/com/sun/star/frame/XComponentLoader.html which points to http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/Spreadsheets/Handling_Spreadsheet_Documents_Files#Creating_and_Loadin g_Spreadsheet_Documents and I think you need to review a few more examples on the web concerning these two parameters.

David
Previous Topic: NLS_NUMERIC_CHARACTERS
Next Topic: where i can get JavaBeans for sound
Goto Forum:
  


Current Time: Tue Dec 06 11:57:21 CST 2016

Total time taken to generate the page: 0.15443 seconds