-------------------------------------------------------------------------------
procedure td_(p_col_count in number,p_content in varchar2,p_align in varchar2,p_black in varchar2) as
v_cont varchar2(300):=p_content;
v_out varchar2(300):='';
begin
for i in 1..p_col_count loop
select substr(v_cont,0,decode(instr(v_cont,';'),0,length(v_cont),instr(v_cont,';')-1))
into v_out from dual ;
htp.p('<td align="'||p_align||'">'||substr(p_black,1,3)||v_out||substr(p_black,4)||'</td>');
v_cont:=substr(v_cont,instr(v_cont,';')+1);
end loop;
end ;
------------------------------------------------------------------------------
--报表内容部分
-----------------------------------------------------------------------------
procedure report_header(p_title in varchar2) as
begin
table_h(90,0,'center');
tr_(1,p_title,'center','<b></b>');
table_t;
end ;
procedure report_subtitle(p_col_count in number,p_content in varchar2,p_align in varchar2,p_black in varchar2) as
begin
tr_h;
td_(p_col_count,p_content,p_align,p_black);
tr_t;
end ;
procedure report_tail(p_content in varchar2) as
begin
table_h(90,0,'center');
tr_(1,p_content,'left','');
table_t;
end;
----------------------------------------------------------------------------------
end ;
/
SQL> @d:\cux_html_report.pck
Package created.
Package body created.
SQL>
编译没有错误后, 使用http://dinya:7777/ss/cux_html_report.main即可查看报表.
如果在main过程中使用 owa_util.mime_header(ccontent_type => 'application/vnd.ms-excel'); 可以直接将数据生成到Excel中.
如:
procedure main as
begin
owa_util.mime_header(ccontent_type => 'application/vnd.ms-excel');
html_header('我的测试报表');
需要使用的话, 可以根据需要修改上面的程序.
文章来源于领测软件测试网 https://www.ltesting.net/