Home » Developer & Programmer » Forms » Client_ole2 + OpenOffice (Oracle 10g, OpenOffice 2.4)
Client_ole2 + OpenOffice [message #448272] Mon, 22 March 2010 08:05 Go to next message
peppebozzo
Messages: 17
Registered: March 2010
Junior Member
Hello, I have trouble creating a document. Rtf and launch OpenOffice Writer. Make me an example with only a string "Hello"??
I used to generate the OLE2 file. Doc and open Microsoft Word, with the proper formatting, and everything worked.
What libraries should I use?
Re: Create .rtf and open with OpenOffice Writer [message #448293 is a reply to message #448272] Mon, 22 March 2010 10:39 Go to previous messageGo to next message
peppebozzo
Messages: 17
Registered: March 2010
Junior Member
I using this code:

DECLARE
 objServiceManager CLIENT_OLE2.OBJ_TYPE;
 objCoreReflection CLIENT_OLE2.OBJ_TYPE;
 
 objDesktop        CLIENT_OLE2.OBJ_TYPE;
 objDocument       CLIENT_OLE2.OBJ_TYPE;
 
 objText     CLIENT_OLE2.OBJ_TYPE;
 sMyText Varchar2(250);
 objCursor  CLIENT_OLE2.OBJ_TYPE;
 
 args CLIENT_OLE2.LIST_TYPE;
 noargs CLIENT_OLE2.LIST_TYPE;
 sUrl varchar2(100) := '"file://c:\temp\test.rtf"';
 
 fileargs CLIENT_OLE2.LIST_TYPE;
 
 
BEGIN
-- create a new document
objServiceManager := client_ole2.create_obj ('com.sun.star.ServiceManager');
 
--Create Instance
args := client_OLE2.CREATE_ARGLIST;
client_OLE2.ADD_ARG (args, 'com.sun.star.frame.Desktop');
objDesktop := client_OLE2.INVOKE_OBJ (objServiceManager, 'createInstance', args);
 
--Open Writer
args := client_OLE2.CREATE_ARGLIST;
client_OLE2.ADD_ARG (args, '"private:factory/swriter"');
client_OLE2.ADD_ARG (args, '"_blank"');
client_OLE2.ADD_ARG (args, '0');
client_OLE2.ADD_ARG (args, noargs);

objDocument := client_OLE2.INVOKE_OBJ (objDesktop, 'loadComponentFromURL', args);

--Setting Text position
objText := client_ole2.invoke_obj(objDocument,'Text');
objCursor := Client_OLE2.INVOKE_OBJ(objText,'createTextCursor()');
 
--Inserting Text
args := client_OLE2.CREATE_ARGLIST;
client_OLE2.ADD_ARG (args,objCursor );
client_OLE2.ADD_ARG (args, '"This is my text"');
client_OLE2.ADD_ARG (args, FALSE);
CLIENT_OLE2.INVOKE(objText,'insertString',args);
 
--Saving
args := client_OLE2.CREATE_ARGLIST;
client_OLE2.ADD_ARG (args,sUrl );
 
objDocument := client_ole2.invoke_obj(objDocument,'storeToURL',args);
 

end;


But at line

client_OLE2.ADD_ARG (args, noargs);


generates an error vaule = '' at webutil library in metod add_arg (accept numeric, boolean or varchar2).

if I must declare
noargs: = client_OLE2.CREATE_ARGLIST;

at line
objDocument: = client_OLE2.INVOKE_OBJ (objDesktop, 'loadComponentFromURL', args);


generates this error:
WUO-705 [OleFunctions.invoke_ret_obj ()] Could not invoke the method: loadComponentFromURL; exception
com.jacob.com.ComFailException: A COM exception has been encountered:
At Invoke of: loadComponentFromURL
Description: Incompatibility between types.

so openoffice documentation is:
// load
com.sun.star.lang.XComponent xComponentLoader.loadComponentFromURL(
"private:factory/sdraw", "_blank", 0, loadProps);
and
// define load properties according to com.sun.star.document.MediaDescriptor

// simply create an empty array of com.sun.star.beans.PropertyValue structs:
PropertyValue[] loadProps = new PropertyValue[0]


I think that the problem is creating an array of one PropertyValue. This PropertyValue would be filled with:
.Name = "Hidden"
.Value = False

how to create a PropertyValue, the simplest solution is to use the method Bridge_GetStruct from the Service Manager. This is my solution:

objProperty CLIENT_OLE2.OBJ_TYPE;

noargs := client_OLE2.CREATE_ARGLIST;
client_OLE2.ADD_ARG (noargs, 'com.sun.star.beans.PropertyValue');
objProperty := client_OLE2.INVOKE_OBJ (objServiceManager, 'Bridge_GetStruct', noargs);

it's correct???

[Updated on: Mon, 22 March 2010 12:15]

Report message to a moderator

Re: Create .rtf and open with OpenOffice Writer [message #448403 is a reply to message #448293] Tue, 23 March 2010 03:54 Go to previous messageGo to next message
peppebozzo
Messages: 17
Registered: March 2010
Junior Member
No answer? You never used cliet_ole2 with OpenOffice?
Re: Create .rtf and open with OpenOffice Writer [message #448406 is a reply to message #448403] Tue, 23 March 2010 04:19 Go to previous messageGo to next message
Littlefoot
Messages: 21818
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
I didn't.

Perhaps someone else did, but they probably didn't see your message.
Re: Create .rtf and open with OpenOffice Writer [message #448466 is a reply to message #448406] Tue, 23 March 2010 10:41 Go to previous messageGo to next message
peppebozzo
Messages: 17
Registered: March 2010
Junior Member
A question for you: how do I pass an empty array instead of
noargs: = client_OLE2.CREATE_ARGLIST
the following function
client_OLE2.ADD_ARG (args, noargs);
??
Re: Create .rtf and open with OpenOffice Writer [message #448595 is a reply to message #448272] Wed, 24 March 2010 03:38 Go to previous messageGo to next message
peppebozzo
Messages: 17
Registered: March 2010
Junior Member
anyone here on the forum has ever used libraries client_ole2 with OpenOffice Writer? But at least you can do or should I look for other solutions?
launch instance OpenOffice [message #448599 is a reply to message #448272] Wed, 24 March 2010 03:48 Go to previous messageGo to next message
peppebozzo
Messages: 17
Registered: March 2010
Junior Member
someone here on the forum has ever been able to launch an instance of the program OpenOffice Writer from Oracle Forms??
This is the code ... you can try and see if it works?

DECLARE
objServiceManager CLIENT_OLE2.OBJ_TYPE;
objDesktop CLIENT_OLE2.OBJ_TYPE;
objDocument CLIENT_OLE2.OBJ_TYPE;

CLIENT_OLE2.LIST_TYPE args;
noargs CLIENT_OLE2.LIST_TYPE;

BEGIN
- Create a new document
objServiceManager: client_ole2.create_obj = ('com.sun.star.ServiceManager');

- Create Instance
args: = client_OLE2.CREATE_ARGLIST;
client_OLE2.ADD_ARG (args, 'com.sun.star.frame.Desktop');
objDesktop = client_OLE2.INVOKE_OBJ (objServiceManager, 'createInstance', args);

- Open Writer
args: = client_OLE2.CREATE_ARGLIST;
client_OLE2.ADD_ARG (args, '"private: factory / swriter"');
client_OLE2.ADD_ARG (args, '' _blank ');
client_OLE2.ADD_ARG (args, '0 ');
noargs = client_OLE2.CREATE_ARGLIST;
client_OLE2.ADD_ARG (args, noargs);

objDocument = client_OLE2.INVOKE_OBJ (objDesktop, 'loadComponentFromURL', args);

end;
Re: Client_ole2 + OpenOffice [message #448788 is a reply to message #448272] Thu, 25 March 2010 04:07 Go to previous message
peppebozzo
Messages: 17
Registered: March 2010
Junior Member
Goal
The Web Forms applications can run on Windows PCs and interacts with Microsoft Office tools on these PCs through the implementation and usage of the WebUtil OLE2 functionality.
When running the Web Forms applications on Linux/Unix as a client PC, can the Forms application interact with OpenOffice tools through WebUtil? If this is not possible, is there another way to make this happen?

Solution
WebUtil OLE2 implementation was created specially for Microsoft Office and apparently does not contain all the features required for OpenOffice.
OpenOffice uses some principles that are quite different than that of Microsoft Office's.

The valid option to let the Forms application interact with applications like OpenOffice on the Linux/Unix client machine is that:
- Create a JavaBean that can interface with OpenOffice.
- Then implement this JavaBean in the Forms application.
* OpenOffice offers access to its functions via OOoBean:
http://api.openoffice.org/docs/DevelopersGuide/OfficeBean/OfficeBean.xhtml
Assistance regarding the OOoBean can be obtained from the product (OpenOffice) vendor.
Previous Topic: Selective reords per page
Next Topic: How to Fixing Internet Explorer Crash on Launching Oracle Forms Application with jInitiator
Goto Forum:
  


Current Time: Fri Sep 20 10:28:44 CDT 2024