Home » Developer & Programmer » Forms » MS WORD PROBLEM (ORACLE 10g Developer Suite)
MS WORD PROBLEM [message #513525] Tue, 28 June 2011 01:10
khawja_bilalahmed
Messages: 7
Registered: August 2008
Location: KHI
Junior Member
Dear All,

I am using this code for writing data from oracle to MS Word 2000. MS WORD is opened but data is not written on word. I also want to read data from MS Word what change is needed in he code . Can anyone help me thanks in advance

Declare
hApplication OLE2.Obj_Type;
hDocuments OLE2.Obj_Type;
hDocument OLE2.Obj_Type;
hNewDocument OLE2.Obj_Type;
hSelection OLE2.Obj_Type;
args OLE2.List_Type;

vBookmark100 VarChar2(100);
vBookmark102 VarChar2(100);
Begin
/*ARG_LIST := OLE2.CREATE_ARGLIST;
OLE2.ADD_ARG(ARG_LIST, FILE);
OLE2.INVOKE(APPL_ID, 'FileOpen', ARG_LIST);
OLE2.DESTROY_ARGLIST(ARG_LIST);*/

hApplication := ole2.create_obj ('Word.Application');
ole2.set_property (hApplication, 'Visible', 1);
hDocuments := ole2.get_obj_property (hApplication, 'Documents');
---------------------------------------------------------------------------
args := ole2.create_arglist;
ole2.add_arg(args, 'c:\amoltest.doc');
hDocument :=ole2.invoke_obj (hDocuments, 'Open', args);
---------------------------------------------------------------------------
hSelection := ole2.get_obj_property(hApplication,'Selection');
select 'Amol - Bookmark100','Amol - bookmark102'
into vBookmark100,vBookmark102
from Dual;
-- Go to the 1st bookmark
----------------------------------------------------------
--Message('1');
/*ARG_LIST := OLE2.CREATE_ARGLIST;
OLE2.ADD_ARG(ARG_LIST, BOOKMARK);
OLE2.INVOKE(APPL_ID, 'EditGoTo', ARG_LIST);
OLE2.DESTROY_ARGLIST(ARG_LIST);

ARG_LIST := OLE2.CREATE_ARGLIST;
OLE2.ADD_ARG(ARG_LIST, CONTENT);
OLE2.INVOKE(APPL_ID, 'Insert', ARG_LIST);
OLE2.DESTROY_ARGLIST(ARG_LIST); */
----------------------------------------------------------
Args:=OLE2.Create_ArgList;
OLE2.Add_Arg (Args, 'bookmark100');
--OLE2.Invoke (Word,'WW7_EditGoto',Arg);
OLE2.Invoke (hDocument,'EditGoto',Args);
OLE2.Destroy_ArgList (Args);
---------------------------------------------------------
--Message('2');
-----------------------------------------------------------
Args:=OLE2.Create_ArgList;
OLE2.Add_Arg (Args, Nvl(vBookmark100, '#EMPTY#'));
OLE2.Invoke (hDocument,'Insert',Args);
OLE2.Destroy_ArgList (Args);
----------------------------------------------------------
--Message('3');
----------------------------------------------------------
Args:=OLE2.Create_ArgList;
OLE2.Add_Arg (Args, 'bookmark102');
--OLE2.Invoke (Word,'WW7_EditGoto',Arg);
OLE2.Invoke (hDocument,'EditGoto',Args);
OLE2.Destroy_ArgList (Args);
--Message('4');
---------------------------------------------------------------------
Args:=OLE2.Create_ArgList;
OLE2.Add_Arg (Args, Nvl(vBookmark102, '#EMPTY#'));
OLE2.Invoke (hDocument,'Insert',Args);
OLE2.Destroy_ArgList (Args);
--Message('4');
-- Save the document as a new file

-- hNewDocument := ole2.get_obj_property (hApplication, 'ActiveDocument');
-- ole2.set_property (hNewDocument, 'ReadOnlyRecommended', -1);
-- ole2.set_property (hNewDocument, 'SaveAs', -1);
------------------------------------------------
args := ole2.create_arglist;
ole2.add_arg (args, 'c:\amoltest.doc');
ole2.invoke (hDocument, 'SaveAs', args);
ole2.destroy_arglist (args);
----------------------------------------------
--Message('4');
args := ole2.CREATE_ARGLIST;
ole2.ADD_ARG(args, 0);
ole2.INVOKE(hDocument, 'Protect', args);
ole2.destroy_arglist (args);

/* -- Quit Word
args := ole2.create_arglist;
ole2.add_arg (args, 0);
ole2.invoke (hApplication, 'QUIT', args);
ole2.destroy_arglist (args);
ole2.release_obj (hApplication);
ole2.release_obj (hDocuments);
--ole2.release_obj (hSelection);
--Message('5'); */

End;
Previous Topic: LOV
Next Topic: problem to delete record
Goto Forum:
  


Current Time: Tue Sep 17 18:55:20 CDT 2024