Thanks for the question, Harshad.
Asked: October 05, 2016 - 6:59 am UTC
Last updated: October 05, 2016 - 11:45 am UTC
Version: Oracle 10g
Viewed 1000+ times
You Asked
We are using below code for excel property
p_file_name:='demo.xls';
UTL_TCP.
write_line (v_tcp_connection,
'Content-Type: application/ms-excel;'); ----- 2ND BODY PART.
UTL_TCP.
write_line (v_tcp_connection, 'Content-Disposition: attachment;'); ----- INDICATES THAT THIS IS AN ATTACHMENT
Rc := UTL_TCP.write_line (v_tcp_connection, ' filename=' || p_file_name); ----- SUGGESTED FILE NAME FOR ATTACHMENT
Rc := UTL_TCP.write_line(v_tcp_connection,'Content-Transfer-Encoding: base64' || p_file_name);
Rc := UTL_TCP.write_line (v_tcp_connection, '');
but when we are opening xls file in email that file opening with error saying
"The file format and extension of "demo.xls" don't match. The file could be corrupted or unsafe. Unless you trust its source,dont open it.Do you want to open it anyway? "
Please suggest how to fix this issue?
Thanks,
Harshad.
and Connor said...
Well - you need to write out the data in xls format, not just mention its filename.
And writing out xls is not trivial - its a proprietary Microsoft format.
It might be easier to write out CSV.
Alternatively, check out the AMIS routine to create xlsx files.
https://technology.amis.nl/tag/as_xlsx/
Is this answer out of date? If it is, please let us know via a Comment