+ Reply to Thread
Results 1 to 3 of 3

Thread: Printing a GridView control with formatting intact

  1. #1
    Ambulare is offline VB.NET Forum Newbie Ambulare is on a distinguished programming path ahead
    .NET Framework
    .NET 3.5 (VS 2008)
    Join Date
    Oct 2009
    Posts
    2
    Reputation
    0

    Default Printing a GridView control with formatting intact

    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!

  2. #2
    JohnH's Avatar
    JohnH is offline VB.NET Forum Moderator JohnH has a reputation beyond repute JohnH has a reputation beyond repute JohnH has a reputation beyond repute JohnH has a reputation beyond repute JohnH has a reputation beyond repute JohnH has a reputation beyond repute JohnH has a reputation beyond repute JohnH has a reputation beyond repute JohnH has a reputation beyond repute JohnH has a reputation beyond repute JohnH has a reputation beyond repute
    .NET Framework
    .NET 4.0
    Join Date
    Dec 2005
    Location
    Norway
    Age
    37
    Posts
    10,843
    Reputation
    1443

    Default

    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.

  3. #3
    Ambulare is offline VB.NET Forum Newbie Ambulare is on a distinguished programming path ahead
    .NET Framework
    .NET 3.5 (VS 2008)
    Join Date
    Oct 2009
    Posts
    2
    Reputation
    0

    Default

    Thank you very much, JohnH, that's solved my problem!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts