在报告导出时设置列标题

时间:2013-02-11 09:09:52

标签: oracle-apex

我正在使用以下博文来帮助我导出报告。它工作得很好,但我想知道是否可以设置列标题名称?

http://spendolini.blogspot.co.uk/2006/04/custom-export-to-csv.html

1 个答案:

答案 0 :(得分:0)

如果你想要做的就是提供一个带有列标题的初始行:

begin
   -- Set the MIME type
   owa_util.mime_header( 'application/octet', FALSE );
   -- Set the name of the file
   htp.p('Content-Disposition: attachment; filename="emp.csv"');
   -- Close the HTTP Header
   owa_util.http_header_close;
   -- Send the initial row with headers
   htp.prn('Ename,Empno,Department'||chr(13));
   -- Loop through all rows in EMP
   for x in (select e.ename, e.empno, d.dname
             from emp e, dept d where e.deptno = d.deptno
             and e.deptno like :P1_DEPTNO)
   loop 
   -- Print out a portion of a row, 
   -- separated by commas and ended by a CR
   htp.prn(x.ename ||','|| x.empno ||','||
            x.dname || chr(13));
   end loop;
   -- Send an error code so that the
   -- rest of the HTML does not render
   --htmldb_application.g_unrecoverable_error := true;
   --use stop apex_engine 
   apex_application.stop_apex_engine;
end;

基本上,您只需在发出数据行之前再发出一行。

我评论htmldb_application赞成apex_application.stop_apex_engineSee documentation