开发者

Set the column width when outputting to HTML using SQLPLUS?

I am using the 'SET MARKUP HTML ON' option to output a result table from a query to html using SQLPLUS.

I want to be able to explicitly specify that some columns need to be a specific pixel width.

Is this possibly using the 'SET MARKUP HTML OPTION' ?? I would rather not have to just use the regular spooling option, and create t开发者_运维知识库he html table manually.

Edited:

I have tried something like:

SET MARKUP HTML ON SPOOL ON PREFORMAT OFF ENTMAP OFF

SPOOL file.html
column aString heading "New Heading"
column aNumber heading "<p style='width:100px'>800SetColA</p>"

SELECT 'Some long String' aString, 3 aNumber FROM dual
UNION ALL
SELECT 'Some other String' aString, 9 aNumber FROM dual;
SPOOL OFF

Which does not work!! the width style tag needs to be set on the th tag and not the p tag.


You can use the COLUMN ** HEADING to do this as such:

SET PAGESIZE 50000
SET MARKUP HTML ON TABLE "class=detail cellspacing=0" ENTMAP OFF
column colA heading "<p style='width:800px'>800SetColA</p>" format a40

column colB heading "<p style='width:10px'>10SetColB</p>" format a40

spool test.html

select level cola, level-5 colb from dual connect by level <10 ;

spool off

you can also use style sheets via this approach, tht

Some helpful links: http://www.stanford.edu/dept/itss/docs/oracle/10g/server.101/b12170/ch8.htm http://gennick.com/html.html


If you want to use stylesheets .. Here is an example :-

set markup html on spool on entmap off -
     head '-
     <style type="text/css"> -
        table { font-family: verdana,arial,sans-serif; font-size:11px;color:#333333;border-width: 1px;border-color: #666666;border-collapse: collapse; } -
        th { border-width: 1px;padding: 8px;border-style: solid;border-color: #666666;background-color: #dedede; } -
        td { border-width: 1px;padding: 8px;border-style: solid;border-color: #666666;background-color: #ffffff; } -
     </style>' 

spool op.html
exit
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜