Home » Developer & Programmer » Application Express, ORDS & MOD_PLSQL » Create downloadable RTF
Create downloadable RTF [message #168245] Wed, 19 April 2006 07:48 Go to next message
tkstock
Messages: 28
Registered: April 2006
Location: Richmond
Junior Member
I have a document stored with RTF tagging in a CLOB. How can I create a link dynamically that will allow the user to download the RTF and save it as a file on their local machine? It should be noted that I'm loading the clob into a variable and modifying it in PL/SQL before the download, so that may affect your answer.

Thanks for any help you can provide!!
Re: Create downloadable RTF [message #168275 is a reply to message #168245] Wed, 19 April 2006 09:24 Go to previous message
tkstock
Messages: 28
Registered: April 2006
Location: Richmond
Junior Member
Nevermind! Figured it out! I've provided the code below for future reference!

declare
    v_clob Clob;
    v_blob Blob;
    v_in Pls_Integer := 1;
    v_out Pls_Integer := 1;
    v_lang Pls_Integer := 0;
    v_warning Pls_Integer := 0;
begin
    DBMS_LOB.createtemporary(v_blob, false, DBMS_LOB.session);

    v_clob := MY_REPORT_CLOB_IN_RTF_FORMAT;

    if v_clob is not null then 
       DBMS_LOB.convertToBlob(v_blob, v_clob, DBMS_LOB.getlength(v_clob), v_in, v_out, 
             DBMS_LOB.default_csid, v_lang, v_warning);

       owa_util.mime_header('application/msword',false);
       htp.p('Content-disposition: attachment; filename=report.rtf');
       owa_util.http_header_close;
    
       wpg_docload.download_file(v_blob);
    end if;
end;


This is done within a Page Process.

[Updated on: Wed, 19 April 2006 09:26]

Report message to a moderator

Previous Topic: Unable to install HTML DB
Next Topic: File upload + PL/SQL Server Pages
Goto Forum:
  


Current Time: Thu Mar 28 17:52:29 CDT 2024