On the move:

I'm currently moving the following to their own blogs: Unix, HTML for Blogs, Perl & Java.
The links are on the left side.

Monday, October 20, 2008

Using Colors and Fonts in HTML Reports


This is absolutely a sign of a person with too much time on their hands! Colors & fonts? Who knows where this will lead. Anyway, I usually use <H1> to indicate a title, but you can't if you want to set size, color or face; it will override these.

There are many internet sites that give a list of all the colors, faces and sizes so I'm not going to list them here again. I did want to make a note of how they worked in the code. Again, for any column that will have HTML codes in it, you must define with 'Entmap Off.'

I also highlighted the president's position by using a case statement.

(The title was broken onto 4 lines and concatenated simply to list in this blog. Initially, it was one record.)
Set Term Off Echo Off Heading Off Linesize 2000 Feedback Off
Set Markup Html On Entmap On Spool On Preformat Off

Column Title Entmap Off
Column Ename Entmap Off Format A100 Heading EName|Job
Column Sal Format 9,999

Spool Test.Html
Column User New_Value xSchema Noprint
Column Rundate New_Value xRundate Noprint
Column Name New_Value xDatabase Noprint

Select '<Font Size=7><Font Color = "#FF0000"><Font Face ="Amazone BT">'
||'<Center>Names, Jobs and Salaries</Center>'
||'<Center><H2>(President is shown in red)'
||'</H2></Center></Font><Font Color = Ff0000>'
Title,
-------------------------------------------------------------------------
User,
Name,
-------------------------------------------------------------------------
To_Char(Sysdate,'fmMonth Dd, Yyyy Day')
||To_Char(Sysdate,' Hh24:Mi')
As
Rundate
-------------------------------------------------------------------------
From V$Database;

Prompt Run Date : &xRunDate
Prompt Output : Test.Html
Prompt Schema : &xSchema @ &xDatabase

Set Heading On

Select Empno,
Case When Job = 'PRESIDENT'
Then '<Font Color = "#Ff0000"><B>'
||Ename
||',<br>'
||Job
||'<Font Color = Ff0000></B>'
Else Ename
||',<br>'
||Job
End
As
Ename,
Sal,
Deptno
From Emp;

Spool Off
Set Markup Html Off Entmap Off Spool Off Preformat Off
Set Echo On Term On

No comments:

Post a Comment