inserting data to a word file [message #181446] |
Mon, 10 July 2006 03:08 |
emadbsb
Messages: 334 Registered: May 2005 Location: egypt
|
Senior Member |
|
|
Hii all
i want to insert record from a table and put it in a word file
how can i do this
Thanks for everyone helped and helping me
|
|
|
|
|
Re: inserting data to a word file [message #181945 is a reply to message #181872] |
Wed, 12 July 2006 05:31 |
|
bhupinderbs
Messages: 67 Registered: July 2006 Location: Bangalore
|
Member |
|
|
Hi
You can use TEXT_IO builtin package or use DDE. Here is code for DDE.
DECLARE
APPID PLS_INTEGER;
CONVID PLS_INTEGER;
DOCID PLS_INTEGER;
SYS_DATE CHAR(8);
EMP_NAME CHAR(40);
BEGIN
SELECT TO_CHAR(SYSDATE,'MM/DD/YY') INTO SYS_DATE FROM DUAL;
EMP_NAME := 'TESTING 1 2 3 4';
APPID := DDE.APP_BEGIN('C:\Program Files\Microsoft Office\Office\WINWORD.EXE',
DDE.APP_MODE_MINIMIZED);
CONVID := DDE.INITIATE('WINWORD','SYSTEM');
DDE.EXECUTE(CONVID,'[FileOpen "c:\bhupinder\name.doc"]', 10000);
DOCID := DDE.INITIATE('WINWORD','c:\bhupinder\name.doc');
DDE.POKE(DOCID,'BOOKMARK1', :poke_test,DDE.CF_TEXT,10000);
DDE.POKE(DOCID,'BOOKMARK2', :poke_test2,DDE.CF_TEXT,10000);
DDE.EXECUTE(DOCID,'[FileSaveAs "c:\bhupinder\name123.doc"]', 10000);
DDE.TERMINATE(CONVID);
DDE.TERMINATE(DOCID);
EXCEPTION
WHEN DDE.DDE_APP_FAILURE THEN
MESSAGE('WORD FOR WINDOWS CANNOT START.');
WHEN DDE.DDE_PARAM_ERR THEN
MESSAGE('A NULL VALUE WAS PASSED TO DDE');
WHEN DDE.DMLERR_NO_CONV_ESTABLISHED THEN
MESSAGE('DDE CANNOT ESTABLISH A CONVERSATION');
WHEN DDE.DMLERR_NOTPROCESSED THEN
MESSAGE('A TRANSACTION FAILED');
END;
This will solve your problem.
Bhupinder Singh
|
|
|
Re: inserting data to a word file [message #181954 is a reply to message #181446] |
Wed, 12 July 2006 06:04 |
emadbsb
Messages: 334 Registered: May 2005 Location: egypt
|
Senior Member |
|
|
thanks for your reply
i have another question on this issue
if i that word file already containning a data fields
and i want to insert after this fields
e.g
the word file have a field of "name"
name:
i want to insert to that word file the value of the name from a table so that the word file looks like
name:emad
"emad" is a field from a table i want to insert it to that word file
[Updated on: Wed, 12 July 2006 06:05] Report message to a moderator
|
|
|
|