J
Jakki
Hi all,
I have made a web site where I produce report data to be (optionally) viewed
in Excel at the client computer. This is how I do it i Visual Basic (Studio
2005, .NET 2.0) (extract) at the web server (in the *.aspx.vb file):
Dim delimiter As Char = vbTab
Response.Clear()
Response.Cache.SetCacheability(HttpCacheability.NoCache)
Response.AppendHeader("content-disposition",
"inline;filename=report.xls")
Response.ContentType = "application/ms-excel"
Dim lstrbReportData As StringBuilder = GetTheData(delimiter)
Response.Write(lstrbReportData.ToString )
Response.End()
Response.Close()
This works fine EXCEPT that Excel will do data conversions. E.g. leading
zeroes are removed, values may be converted to dates etc.
Is there a way I can tell Excel to treat all data as plain text, similar to
when I manually import a text file to excel, where I can set all columns to
Text format instead of General?
Some Response.appendheader maybe?
I have made a web site where I produce report data to be (optionally) viewed
in Excel at the client computer. This is how I do it i Visual Basic (Studio
2005, .NET 2.0) (extract) at the web server (in the *.aspx.vb file):
Dim delimiter As Char = vbTab
Response.Clear()
Response.Cache.SetCacheability(HttpCacheability.NoCache)
Response.AppendHeader("content-disposition",
"inline;filename=report.xls")
Response.ContentType = "application/ms-excel"
Dim lstrbReportData As StringBuilder = GetTheData(delimiter)
Response.Write(lstrbReportData.ToString )
Response.End()
Response.Close()
This works fine EXCEPT that Excel will do data conversions. E.g. leading
zeroes are removed, values may be converted to dates etc.
Is there a way I can tell Excel to treat all data as plain text, similar to
when I manually import a text file to excel, where I can set all columns to
Text format instead of General?
Some Response.appendheader maybe?