Question Printing a GridView control with formatting intact

Ambulare

New member
Joined
Oct 19, 2009
Messages
2
Programming Experience
Beginner
Hi all,

I've got a gridview control on an asp web page which I format dynamically using VB to assign Red/Amber/Green based on the values in each cell of the grid.

On rendering, this creates a nicely formatted table with HTML tags assigning colours to each cell.

e.g.

Code:
...</tr><tr style="background-color:White;font-weight:bold;">
			<td>MyRowTitle</td><td style="color:Black;background-color:DarkOrange;font-size:9pt;">51.7</td><td style="color:Black;background-color:DarkOrange;font-size:9pt;">68.6</td></tr>...
etc etc...

However, on pressing "print" or "print preview", all these HTML style tags are ignored and I get a plain table with no colouring or font formats. I'm finding this quite odd as all the other style tags on the page are treated as normal.

Can anyone advise me on how to keep the formatting intact for printing?

Many thanks!
 

JohnH

VB.NET Forum Moderator
Staff member
Joined
Dec 17, 2005
Messages
15,334
Location
Norway
Programming Experience
10+
This is a user setting with the browser. Omitting backcolors is usually more printer friendly with greyscale printers, and more economical with color printers. In IE the setting is in Options>Advanced>Printing ('Print Background colors and images' check box). In FF there a checkbox to enable the same in File>Page Setup. You should be able to find similar user setting in other browsers.
 

Ambulare

New member
Joined
Oct 19, 2009
Messages
2
Programming Experience
Beginner
Thank you very much, JohnH, that's solved my problem!
 
Top Bottom