Monday, January 1, 2018

Open Word Document From Oracle 10g Form

1-Configure webutil as per this post
10g.htmlhttp://oracleformtips.blogspot.com/2017/12/setup-webutil-for-developer-suite-10g.html
2-on button press use this
begin
app CLIENT_OLE2.OBJ_TYPE;
docs CLIENT_OLE2.OBJ_TYPE;
doc CLIENT_OLE2.OBJ_TYPE;
selection CLIENT_OLE2.OBJ_TYPE;
args CLIENT_OLE2.LIST_TYPE;
pid WEBUTIL_HOST.PROCESS_ID;
FilePath varchar2(250);
file_doc_no varchar2(80);
c number;
 AppID PLS_INTEGER;
BEGIN

   --example : FilePath:=d:\d.doc
   --you can pass this from function
  FilePath:='d:\d.doc';
 
   
if webutil_file.file_exists (FilePath) then
 


app := CLIENT_OLE2.CREATE_OBJ('Word.Application');
CLIENT_OLE2.SET_PROPERTY(app,'Visible', 1);
docs := CLIENT_OLE2.INVOKE_OBJ(app, 'documents'); 
args := CLIENT_OLE2.create_arglist;
CLIENT_OLE2.add_arg(args, FilePath);
doc := CLIENT_OLE2.INVOKE_OBJ(docs,'Open', args);
CLIENT_OLE2.destroy_arglist(args);
CLIENT_OLE2.release_obj(docs);
CLIENT_OLE2.release_obj(app);


   
else
 

  app := CLIENT_OLE2.CREATE_OBJ('Word.Application');

  CLIENT_OLE2.SET_PROPERTY(app,'Visible',1);
  docs := CLIENT_OLE2.GET_OBJ_PROPERTY(app, 'Documents');
  doc  := CLIENT_OLE2.INVOKE_OBJ(docs, 'add'); 
  selection := CLIENT_OLE2.GET_OBJ_PROPERTY(app, 'Selection');

  -- insert data into new document from long item
  --CLIENT_OLE2.SET_PROPERTY(selection, 'Text', :ole.oletext);

  -- save document as example.tmp
  args := CLIENT_OLE2.CREATE_ARGLIST;
 
  CLIENT_OLE2.ADD_ARG(args, FilePath);

  CLIENT_OLE2.INVOKE(doc, 'SaveAs', args);
  CLIENT_OLE2.DESTROY_ARGLIST(args);

end if;

end;

No comments:

Post a Comment

signer information does not match signer information of other classes in the same package in Oracle forms java bean

The Main issue to this , is there are many jar File have same package name on it To Solve the issue ,used  JDeveloper or any java develo...