Home » Developer & Programmer » Forms » Printing a word document in oracle form 10g. (Oracle AS 10g. windows Server 2003 64bit.)
Printing a word document in oracle form 10g. [message #493700] Wed, 09 February 2011 07:21 Go to next message
AshrafKittaneh26
Messages: 18
Registered: June 2008
Location: UAE
Junior Member
Dear Colleges,
I have This Code working on the local form builder after starting the oc4j and run the form. but using OLE2.
but when using the Cleint_ole2 on the application to invoke an object on the client machine.

but nothing happend, while i have tested the webutil configaration and its working fine.

i use this code to print any word document without openning it.
and here is the code in when_button_pressed

DECLARE
application CLIENT_OLE2.OBJ_TYPE; -- Declare a object OLE
args CLIENT_OLE2.LIST_TYPE; -- Declare List of Parameters to obj. OLE
begin
application := CLIENT_OLE2.CREATE_OBJ('WORD.Basic'); -- Start a process WordBasic
args:= CLIENT_OLE2.CREATE_ARGLIST; -- Create a list of Parameters
-- Add param. file_name with path(x. c:\temp\my.doc) :blk01 is my block
CLIENT_OLE2.ADD_ARG(args, '\\Server_ip\test\1.doc');
-- Open the file
CLIENT_OLE2.INVOKE(application, 'FileOpen', args);
-- Destroy list of Parameter, do not use anymore.
CLIENT_OLE2.DESTROY_ARGLIST(args);
-- Adjust Parameters and print the file
args:=CLIENT_OLE2.CREATE_ARGLIST;
CLIENT_OLE2.ADD_ARG(args, 1); -- .Background
CLIENT_OLE2.ADD_ARG(args, 0); -- .AppendPrFile
CLIENT_OLE2.ADD_ARG(args, 0); --.Range
CLIENT_OLE2.ADD_ARG(args, '""'); -- .PrToFileName
CLIENT_OLE2.ADD_ARG(args, '""'); -- .From
CLIENT_OLE2.ADD_ARG(args, '""'); -- .To
CLIENT_OLE2.ADD_ARG(args, 0); -- .Type 0 Document
CLIENT_OLE2.ADD_ARG(args, 1); -- .NumCopies

CLIENT_OLE2.INVOKE(application, 'FilePrint', args);
CLIENT_OLE2.DESTROY_ARGLIST(args);
message('Wait, printing!');
-- close all files without ask to save
--( FileCloseAll 2 = close all without saving )
args:=CLIENT_OLE2.CREATE_ARGLIST;
CLIENT_OLE2.ADD_ARG(args, 2);
CLIENT_OLE2.INVOKE(application, 'FileCloseAll', args);
CLIENT_OLE2.DESTROY_ARGLIST(args);

CLIENT_OLE2.INVOKE(application,'FileExit');
CLIENT_OLE2.RELEASE_OBJ(application); -- Release the OLE object
End if;
End;
Any help will be Appreciated.

Thank in advance.
Re: Printing a word document in oracle form 10g. [message #534780 is a reply to message #493700] Fri, 09 December 2011 02:19 Go to previous message
rajesh_j_it
Messages: 1
Registered: November 2011
Junior Member
I have tested using your code. I don't have physical priter to test, So I tested using 3 virtual printers. They are Microsoft Image Writer, Microsoft XPS printer, Adobe PDF. It is working fine with Microsoft Image Writer, but other 2 are not. Did you get solution for you problem?.
Previous Topic: Running Oracle 10g DS and Oracle Forms 11g on same OS and on same machine
Next Topic: Webtil, uploading file on vista
Goto Forum:
  


Current Time: Fri Aug 09 14:12:42 CDT 2024