title: How do we export a ms-word (or rtf) document (from a web browser) to generated by pl/sql?
body: <p>I need to generate a ms-word document from a pl/sql query to export a set of reports through a web browser.</p>
  
  <p>I have been searching for a specific way to modify the content headers using owa_util.mime_header etc etc but could not really get a working proof of concept to get the web page to present the user to download/open/save a ms-word document.</p>
  
  <p>I know it's not much but..</p>
  
  <pre><code>   begin
      OWA_UTIL.MIME_HEADER ( 'application/vnd.ms-word', false);
      htp.print('Content-Disposition:attachment;filename="test.doc"');
      OWA_UTIL.HTTP_HEADER_CLOSE;
          for x in (select first_column, second_column from my_table)
              loop
                  htp.p(x.first_column||'&lt;br/&gt;'||x.second_column||'&lt;br/&gt;&lt;br/&gt;');
              end loop;
      end;
  </code></pre>
  
  <p>Could someone please shed some light on how can I create a procedure that generates output to html which intercept the browser headers and prints out the query content to a word document?</p>
  
  <p>By the way, the current environment (restriction) I am running this from:
  Oracle APEX 3.0.1 (not 3.1, which I believe has an export to word doc feature).</p>
  
  <p>Thanks in advance.</p>