cell background color

V

Vam

Hi,

My program makes an HTML report which needs to be easily printable. On this
report is a table, and one of the columns in the table needs to express a
color. I've done this by setting the background of the cells in that column
to their colors (which differ from row to row), but those background colors
don't print unless a certain option is set in IE, which is apparently off by
default. The way we've figured around this is to add a small colored bitmap
to the color cells instead of using their background color property. But
the problem with that is finding the correct size of the bitmap, and the
correct positioning. anybody have any idea how I could get the pixel size
of a cell in an HTML table? And the position that I would need to place a
bitmap so that it covers that cell? Or is there a better way of getting
around this color problem in general, so that it'll always print no matter
what the IE option settings?
 
J

JDS

Or is there a better way of getting
around this color problem in general, so that it'll always print no matter
what the IE option settings?

In my experience, reliable printing of HTML pages "in the wild" is
impossible.

One solution (and admittedly an imperfect one) that I have used is to
generate a PDF version of a page (genreated on the server) for printing.
PDF, being essentially an encapsulated printed page, is far more reliable
for printing (but also not perfect!)
 
R

Richard

My program makes an HTML report which needs to be easily printable. On
this
report is a table, and one of the columns in the table needs to express
a
color. I've done this by setting the background of the cells in that
column
to their colors (which differ from row to row), but those background
colors
don't print unless a certain option is set in IE, which is apparently
off by
default. The way we've figured around this is to add a small colored
bitmap
to the color cells instead of using their background color property.
But
the problem with that is finding the correct size of the bitmap, and
the
correct positioning. anybody have any idea how I could get the pixel
size
of a cell in an HTML table? And the position that I would need to
place a
bitmap so that it covers that cell? Or is there a better way of
getting
around this color problem in general, so that it'll always print no
matter
what the IE option settings?


Try using CSS definitions.
<style>

td.color1 { background:#F00; }

</style>

<table>
<tr><td class="color1">text</td></tr>
</table>

The real trick is, getting the screen colors to match the printed colors.
As the screen uses the "rgb" method while the printer uses the "cmyk"
method.
 
S

Sid Ismail

: My program makes an HTML report which needs to be easily printable. On this
: report is a table, and one of the columns in the table needs to express a
: color. I've done this by setting the background of the cells in that column
: to their colors (which differ from row to row), but those background colors
: don't print unless a certain option is set in IE which is apparently off by
: default.

If you want to empasize a column, why not change the COLOR of the
contents of the cells in that column. URL?

Sid
 
R

Richard

:: My program makes an HTML report which needs to be easily printable.
:: On this
:: report is a table, and one of the columns in the table needs to
:: express a
:: color. I've done this by setting the background of the cells in that
:: column
:: to their colors (which differ from row to row), but those background
:: colors
:: don't print unless a certain option is set in IE which is apparently
:: off by
:: default.
If you want to empasize a column, why not change the COLOR of the
contents of the cells in that column. URL?

the url is www.google.com
The only way you function is through a URL?
"Honey, would you get me a cup of coffee please?"
"What's the URL?"
<slap>
 
B

Beauregard T. Shagnasty

Try using CSS definitions. <style>

td.color1 { background:#F00; }

Can you not read, Richard? (Oh, rhetorical question.)
The real trick is, getting the screen colors

The real trick is, getting the printer to recognize background colors.
Vam stated in the OP that background colors do not print by default.
Neither will yours.

Vam, do not follow any advice from Richard.
 
J

Jonathan N. Little

Vam wrote:
to the color cells instead of using their background color property. But
the problem with that is finding the correct size of the bitmap, and the
correct positioning. anybody have any idea how I could get the pixel size
of a cell in an HTML table?
<snip>
Even using an image for the background will not guarantee that the color
will print, it depends on the browser settings. But to answer your image
question, you do not have to know the exact dims of the table cell to
'color it' will an image. If you want a single color value, i.e., not
shaded or a picture of something, you can use a single pixel GIF image
of the color you want and your can style it with CSS

..YourClassName { background-image: url(YourColor.gif) }

The image is tiled by default and will fill the background whatever the
element size it. Again, though it may or may not print depending on the
browser settings.
 
S

Sid Ismail

: > Richard wrote:


Richard is plonked here - cannot see his dumb replies.

Yes - I'd like to see a URL - the context is important, in many
instances.

Sid
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,014
Latest member
BiancaFix3

Latest Threads

Top