The data is all there but invisible. I am unable to change any type of properties within excel to have the font color change. I have tried changing every attribute on the datagrid that I can think of, and I have also outputted to just a plain generic auto-generate columns datagrid with the same effect.
When i change the response.type from excel to html the datagrid displays fine in black print.
Any tips on how to change this output would be great, we're trying to get this to go live today.
Thanks!
Here is my HTML Code
Expand|Select|Wrap|Line Numbers
- <%@ Page Language="vb" AutoEventWireup="false" Codebehind="TimeReport.aspx.vb" Inherits="xxxx" %>
- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
- <HTML>
- <HEAD>
- <title>TimeReport</title>
- <meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
- <meta name="CODE_LANGUAGE" content="Visual Basic .NET 7.1">
- <meta name="vs_defaultClientScript" content="JavaScript">
- <meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
- </HEAD>
- <body bottomMargin="0" leftMargin="0" topMargin="0" rightMargin="0">
- <form id="Form1" method="post" runat="server">
- <asp:DataGrid ID="dataGrid" AutoGenerateColumns=True runat=server></asp:DataGrid>
- </form>
- </body>
- </HTML>
Here is the VB code:
Expand|Select|Wrap|Line Numbers
- Private Sub Page_Load()
- Response.Clear()
- Response.ContentType = "application/vnd.ms-excel"
- Response.Charset = ""
- Dim dsExport As DataSet = getReportData(dateselect1, dateselect2)
- dataGrid.DataSource = dsExport
- dataGrid.DataBind()
- End Sub
- Private Function getReportData(ByVal d1 As Date, ByVal d2 As Date) As DataSet
- Dim strConnection As String
- Dim sqlCmd As SqlCommand
- Dim ds As New DataSet
- Dim da As SqlDataAdapter
- ' Dim sqlRetrieve As SqlCommand
- Dim sqlConn As SqlConnection
- Dim intTestCount As Integer
- Try
- 'connection string from Web Config
- strConnection = ConfigurationSettings.AppSettings("ConnectionString")
- sqlConn = New SqlConnection(strConnection)
- sqlCmd = New SqlCommand("TimeTracker_ReportGenerate1", sqlConn)
- sqlCmd.CommandType = CommandType.StoredProcedure
- sqlCmd.Parameters.Add("@dtDateRange1", d1)
- sqlCmd.Parameters.Add("@dtDateRange2", d2)
- sqlConn.Open()
- da = New SqlDataAdapter(sqlCmd)
- da.Fill(ds)
- Catch ex As Exception
- Response.Write(ex.ToString & "<br>")
- Finally
- sqlConn.Close()
- End Try
- Return (ds)
- End Function