Hello Everyone....
I have had this problem for 3 days now and after going through many forums...I have had no luck. I am importing information from MS Access which goes to a data grid which in turn is sent to me in a lovely MS Excel File. This IS working however there is a small issue...in one of my columns they are numbers with decimal places. EG: 1234.5678 or 1234.6600.
1234.5678 is importing just fine however 1234.6600 is importing as 1234.66 which is no good.:(
Below is my function to export to Excel..
private void exportToExcel()
{
string fixedName;
fixedName = manNames[0].Replace(' ', '_');
Response.Clear();
Response.AddHeader("content-disposition", "attachment;filename=" +
fixedName + "_quotes.xls");
Response.Charset = "";
// If you want the option to open the Excel file without saving then
// comment out the line below
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.ContentType = "application/vnd.xls";
System.IO.StringWriter stringWrite = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite);
TestGrid.RenderControl(htmlWrite);
Response.Write(stringWrite.ToString());
Response.End();
}
Once the
Response.Write(stringWrite.ToString());
completes, I can see the data in memory showing up as something like:
<td>1234.6600</td><td> ADHESIVE 82X12X3</td><td>SOME COMPANY</td><td>
AS you can see 1234.6600 looks normal however once Response.End() is complete, the Excel file is built and sent to me...but 1234.6600 is displayed as 1234.66.
Any ideas how I can modify this to show as I want?
Thanks in advance.