Quantcast
Channel: ClosedXML - The easy way to OpenXML
Viewing all articles
Browse latest Browse all 1877

New Post: How do I stop getting the "number stored as text" message?

$
0
0
hello,
I have a simmilar problem. I'm using a DataTable as source to export data to Excel File (xls)
When I opening this file all digits I have to convert from text to digit.
What Can I change in my code to solve problem "number stored as text" in my exported data in EXCEL file ??
When I exporting to XLSX I have the same problem and second problem - numeric digit has dot instead of comma. (XLS format has no problem with commas)

 using (XLWorkbook wb = new XLWorkbook())
                {
                    wb.Worksheets.Add(dt);

                    Response.Clear();
                    Response.Buffer = true;
                    Response.Charset = "";
                    //Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
                    Response.ContentType = "application/vnd.ms-excel";
                    Response.AddHeader("content-disposition", "attachment;filename=File1.xls");
                    using (MemoryStream MyMemoryStream = new MemoryStream())
                    {
                        wb.SaveAs(MyMemoryStream);
                        MyMemoryStream.WriteTo(Response.OutputStream);
                        Response.Flush();
                        Response.End();
                    }
                }
Thank you,
Br.

Viewing all articles
Browse latest Browse all 1877

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>