Home » Developer & Programmer » Forms » unable to read excel file
unable to read excel file [message #529515] |
Tue, 01 November 2011 12:17 ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
swapnil_naik
Messages: 269 Registered: December 2009 Location: Mumbai
|
Senior Member |
![swapnilnaik](/forum/theme/orafaq/images/skype.png)
|
|
I am trying to create excel file thru form....in form i create button Excel
WHEN -BUTTON - PRESSED :
Quote:
DECLARE
CURSOR C1 IS
SELECT DEPTNO,DNAME,LOC FROM DEPT;
filename varchAr2(256);
convid pls_integer;
appid pls_integer;
buffer varchar2(5);
i number(3) := 1;
j number(3) := 1;
v_number varchar2(5);
len number(5);
dname varchar2(14);
loc varchar2(13);
out_file text_io.file_type;
begin
filename := get_file_name(file_filter=> 'EXCEL FILES(*.XLS)|*.XLS|',DIALOG_TYPE => 2);
OUT_FILE := TEXT_IO.FOPEN(filename,'W');
TEXT_IO.FCLOSE(OUT_FILE);
Appid := dde.app_begin('C:\Program Files\Microsoft Office\OFFICE11\EXCEL.EXE'||filename,DDE.APP_MODE_MINIMIZED);
CONVID := DDE.InitiAte('EXCEL.EXE',filename);
for r in c1
loop
dde.poke(convid,'R'||J||'C1',R.DEPTNO,DDE.CF_TEXT,1000);
Dde.poke(convid,'R'||J||'C2',R.DNAME,DDE.CF_TEXT,1000);
dde.poke(convid,'R'||J||'C3',R.LOC,DDE.CF_TEXT,1000);
J:= J+1 ;
END LOOP;
TEXT_IO.FCLOSE(OUT_FILE);
EXCEPTION
WHEN DDE.DDE_APP_NOT_FOUND THEN MESSAGE('1');
WHEN DDE.DDE_APP_FAILURE THEN MESSAGE('2');
WHEN DDE.DDE_INIT_FAILED THEN MESSAGE('3');
WHEN DDE.DMLERR_NO_CONV_ESTABLISHED THEN MESSAGE('4');
WHEN OTHERS THEN MESSAGE(SQLERRM);
END;
My excel file opened but it shows unable to read file
i dont know what happens..
My excel version is 2003..
|
|
|
|
Re: unable to read excel file [message #529523 is a reply to message #529522] |
Tue, 01 November 2011 12:35 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
swapnil_naik
Messages: 269 Registered: December 2009 Location: Mumbai
|
Senior Member |
![swapnilnaik](/forum/theme/orafaq/images/skype.png)
|
|
DECLARE
CURSOR C1 IS
SELECT DEPTNO,DNAME,LOC FROM DEPT;
filename varchAr2(256);
convid pls_integer;
appid pls_integer;
buffer varchar2(5);
i number(3) := 1;
j number(3) := 1;
v_number varchar2(5);
len number(5);
dname varchar2(14);
loc varchar2(13);
out_file text_io.file_type;
begin
filename := get_file_name(file_filter=> 'EXCEL FILES(*.XLS)|*.XLS|',DIALOG_TYPE => 2);
OUT_FILE := TEXT_IO.FOPEN(filename,'W');
TEXT_IO.FCLOSE(OUT_FILE);
Appid := dde.app_begin('C:\Program Files\Microsoft Office\OFFICE11\EXCEL.EXE'||filename,DDE.APP_MODE_MINIMIZED);
CONVID := DDE.InitiAte('EXCEL.EXE',filename);
for r in c1
loop
dde.poke(convid,'R'||J||'C1',R.DEPTNO,DDE.CF_TEXT,1000);
Dde.poke(convid,'R'||J||'C2',R.DNAME,DDE.CF_TEXT,1000);
dde.poke(convid,'R'||J||'C3',R.LOC,DDE.CF_TEXT,1000);
J:= J+1 ;
END LOOP;
TEXT_IO.FCLOSE(OUT_FILE);
EXCEPTION
WHEN DDE.DDE_APP_NOT_FOUND THEN MESSAGE('1');
WHEN DDE.DDE_APP_FAILURE THEN MESSAGE('2');
WHEN DDE.DDE_INIT_FAILED THEN MESSAGE('3');
WHEN DDE.DMLERR_NO_CONV_ESTABLISHED THEN MESSAGE('4');
WHEN OTHERS THEN MESSAGE(SQLERRM);
END;
Sir, i want to create excel file by using this code...but while opening excel file it give me error unable to read file..
|
|
|
|
Re: unable to read excel file [message #529540 is a reply to message #529537] |
Tue, 01 November 2011 13:08 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
swapnil_naik
Messages: 269 Registered: December 2009 Location: Mumbai
|
Senior Member |
![swapnilnaik](/forum/theme/orafaq/images/skype.png)
|
|
DECLARE
CURSOR C1 IS
SELECT DEPTNO,DNAME,LOC FROM DEPT;
filename varchAr2(256);
convid pls_integer;
appid pls_integer;
buffer varchar2(5);
i number(3) := 1;
j number(3) := 1;
v_number varchar2(5);
len number(5);
dname varchar2(14);
loc varchar2(13);
out_file text_io.file_type;
begin
filename := get_file_name(file_filter=> 'EXCEL FILES(*.XLS)|*.XLS|',DIALOG_TYPE => 2);
OUT_FILE := TEXT_IO.FOPEN(filename,'W');
TEXT_IO.FCLOSE(OUT_FILE);
Appid := dde.app_begin('C:\Program Files\Microsoft Office\OFFICE11\EXCEL.EXE'||filename,DDE.APP_MODE_MINIMIZED);
CONVID := DDE.InitiAte('EXCEL.EXE',filename);
for r in c1
loop
dde.poke(convid,'R'||J||'C1',R.DEPTNO,DDE.CF_TEXT,1000);
Dde.poke(convid,'R'||J||'C2',R.DNAME,DDE.CF_TEXT,1000);
dde.poke(convid,'R'||J||'C3',R.LOC,DDE.CF_TEXT,1000);
J:= J+1 ;
END LOOP;
TEXT_IO.FCLOSE(OUT_FILE);
EXCEPTION
WHEN DDE.DDE_APP_NOT_FOUND THEN MESSAGE('1');
WHEN DDE.DDE_APP_FAILURE THEN MESSAGE('2');
WHEN DDE.DDE_INIT_FAILED THEN MESSAGE('3');
WHEN DDE.DMLERR_NO_CONV_ESTABLISHED THEN MESSAGE('4');
WHEN OTHERS THEN MESSAGE(SQLERRM);
END;
|
|
|
|
|
Goto Forum:
Current Time: Sun Feb 09 06:12:37 CST 2025
|