0

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 the 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.

2 Answers 2

1

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

Sign up to request clarification or add additional context in comments.

1 Comment

My mistake ... the example doesn't actually work ... the width style needs to be set on the th tag and not the p tag. Setting it on the p tag doesn't work correctly.
0

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.