Output to Excel - White Cell Background.

Discussion in 'ASP .Net' started by iforsyth, Oct 22, 2003.

  1. iforsyth

    iforsyth Guest

    I'm doing a query against a database table and outputting to Excel via
    Response.ContentEncoding and Response.ContentType.

    Something like the code below where dg is a DataGrid control.

    Response.Clear()
    Response.ContentType = "application/vnd.ms-excel"
    Response.ContentEncoding = System.Text.Encoding.UTF8
    dg.DataSource = objDR
    dg.DataBind()
    dg.RenderControl(hw)
    strTW = tw.ToString()
    Response.Write(strTW)
    Response.Flush()
    Response.Close()

    Everything works fine and the query output generates in Excel, but I
    get this icky white background in all of the cells on the sheet. Is
    there a way to retain the Excel regular, transparent background?
     
    iforsyth, Oct 22, 2003
    #1
    1. Advertising

  2. iforsyth

    zPaul Guest

    You can create a <table> tag to format the output. Excel will interpret
    whatever you put it in.

    "iforsyth" <> wrote in message
    news:...
    > I'm doing a query against a database table and outputting to Excel via
    > Response.ContentEncoding and Response.ContentType.
    >
    > Something like the code below where dg is a DataGrid control.
    >
    > Response.Clear()
    > Response.ContentType = "application/vnd.ms-excel"
    > Response.ContentEncoding = System.Text.Encoding.UTF8
    > dg.DataSource = objDR
    > dg.DataBind()
    > dg.RenderControl(hw)
    > strTW = tw.ToString()
    > Response.Write(strTW)
    > Response.Flush()
    > Response.Close()
    >
    > Everything works fine and the query output generates in Excel, but I
    > get this icky white background in all of the cells on the sheet. Is
    > there a way to retain the Excel regular, transparent background?
     
    zPaul, Oct 23, 2003
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Niels Dybdahl

    Color.white vs. Color.WHITE

    Niels Dybdahl, Oct 6, 2004, in forum: Java
    Replies:
    3
    Views:
    450
    Chris Smith
    Oct 6, 2004
  2. Ben C
    Replies:
    6
    Views:
    2,175
    Leif K-Brooks
    Jan 28, 2007
  3. Franz
    Replies:
    4
    Views:
    2,281
    shakah
    Jul 16, 2008
  4. RAYMOND PISTEY
    Replies:
    5
    Views:
    540
    RAYMOND PISTEY
    May 2, 2010
  5. RJ
    Replies:
    1
    Views:
    245
    Eliyahu Goldin
    Feb 17, 2005
Loading...

Share This Page