2011-03-08 37 views
0

我正在使用「SET MARKUP HTML ON」選項將結果表從查詢輸出到使用SQLPLUS的html。使用SQLPLUS輸出到HTML時設置列寬?

我希望能夠明確指定某些列需要是特定的像素寬度。

這是否可能使用'SET MARKUP HTML OPTION'?我寧願不必使用常規假脫機選項,並手動創建html表。

編輯:

我已經試過類似:

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 

不工作!寬度樣式標籤需要在第n個標籤上設置,而不是p標籤。

回答

1

您可以使用列**前往做到這一點 這樣:

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 

,你也可以通過這種方法使用樣式表,謂

一些有用的鏈接: http://www.stanford.edu/dept/itss/docs/oracle/10g/server.101/b12170/ch8.htm HTTP: //gennick.com/html.html

+0

我的錯誤...這個例子實際上沒有工作...寬度樣式需要設置在th標籤而不是p標籤。將它設置在p標籤上無法正常工作。 – vicsz 2011-03-08 20:47:01

0

如果你想使用樣式表.. - 這是一個例子: -

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