Monday, February 16, 2009

Printing Labels from SQL through HTML

I recently needed to print 3-up address labels with the same information on each. I used a combination of padding, and adjusting the margins in the browser 'Page Setup' to get these to print in the perfs.
  • This title shows in the browser title, and tab: Head "<Title>Test Labels</Title>
  • Where there are four options, they are in this order: top right bottom left.
  • Styles are Dotted Dashed Solid Double Groove Ridge Inset Outset.
This section is for the entire table:
<!-- Body {Border-Width: 5px 5px 5px 5px;             -
Border-Style: outset outset outset outset; -
Border-Color: Gray Gray Gray Gray; -
Background-Color: White; -
}
This section is for each cell:
      Td {Border-Width: 5px 10px 5px 10px;           -
Padding: 0px 50px 0px 0px; -
Border-Style: Inset Inset Inset Inset; -
Border-Color: Gray Gray Gray Gray; -
Background-Color: White; -
-Moz-Border-Radius: 10px 0px 0px 0px; (Rounds edges of cells)

The code:

Set Term Off Echo Off Heading Off Linesize 2000 Feedback Onoff

Set Markup Html On Entmap Off Spool On Preformat Off -
Head "<Title>Test Labels</Title> -
<Style Type='Text/Css'> -
<!-- Body {Border-Width: 0px 0px 0px 0px; -
Border-Style: Outset Outset Outset Outset; -
Border-Color: Gray Gray Gray Gray; -
Background-Color: White; -
} -
Td {Border-Width: 0px 0px 0px 0px; -
Padding: 8px 11px 8px 5px; -
Border-Style: Inset Inset Inset Inset; -
Border-Color: Gray Gray Gray Gray; -
Background-Color: White; -
-Moz-Border-Radius: 0px 0px 0px 0px; -
} -
</Style>" -
Table "Width='100%' Border='0'"

Column Title Entmap Off

Spool Labels.Html

Select --+----------------------------------------------------------------------
--| Left Side Label
--+----------------------------------------------------------------------
'<Font Size=5 Face="Comic Sans" Color="Magenta"><B><Center>'
|| First || '</B> <Br> <Font Size = 3 Color = "Black">'
|| Last || ', ' || Mom_First || '<Br> Age:<B>'|| Age
|| '</B> Birthdate:' || To_Char(Birthdate,'Mm/Dd/Yy') || ' </Font>'
--+----------------------------------------------------------------------
--| Middle Label (Same Code As Above)
--+----------------------------------------------------------------------
, '<Font Size=5 Face="Comic Sans" Color="Magenta"><B><Center>'
|| First || '</B> <Br> <Font Size = 3 Color = "Black">'
|| Last || ', ' || Mom_First || '<Br> Age:<B>'|| Age
|| '</B> Birthdate:' || To_Char(Birthdate,'Mm/Dd/Yy') || ' </Font>'
--+----------------------------------------------------------------------
--| Right side Label (Same Code As Above)
--+----------------------------------------------------------------------
, '<Font Size=5 Face="Comic Sans" Color="Magenta"><B><Center>'
|| First || '</B> <Br> <Font Size = 3 Color = "Black">'
|| Last || ', ' || Mom_First || '<Br> Age:<B>'|| Age
|| '</B> Birthdate:' || To_Char(Birthdate,'Mm/Dd/Yy') || ' </Font>'
From Moms_And_Kids
Order By Last, Birthdate Desc;

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

No comments:

Post a Comment