sql - ClosedXML and digits as text -


I am using ClosedXML to export data from SQL data tables in Excel.

This is part of the export: (DT is a datalet with data from SQL server)

 using  (XL workbook wb = new XLverBook ()) {wb .Worksheets.Add (dt); Response.Clear (); reaction. Buffer = true; Response. Charset = ""; Response.ContentType = "app / vnd.openxmlformats-officedocument.spreadsheetml.sheet"; Response.ContentType = "app / vnd.ms-excel"; Response.AddHeader ("content-type", "attachment; file name = report.xlsx"); (Using the memory stream MyMemoryStream = new memorystream ()) {wb.SaveAs (MyMemoryStream); MyMemoryStream.WriteTo (Response.OutputStream); Response.Flush (); Response.End (); }}  

There are problems:

  • After exporting all the digits

  • There is a dot in the decimal point, but it must be a comma.

Please help me, what can help me to format my export in Excel ?

may help

map the data with datatype

  Private Datatable GetTable () {DataTable Table = New Datatable (); Table. Columns Add ("dosage", typef (int)); Table. Column.ad ("drug", typef (string)); Table Columns Add ("patient", typef (string)); Table. Columns Add ("Date", Typef (DateTime)); Return table; } // A DataTable Var Data Settable = GetTable (); Ws.Cell (7, 1). Value = "from datatile"; Var table with data = ws.Cell (8, 1) .Startable (datatable.assenameremable ()); . Ws.Columns () AdjustToContents (); Wb.SaveAs ("InsertingTables.xlsx");  

or

  datatable.colm [0] .data type = typef (int32); DataTable.Column [1] .DataType = typeof (string); DataTable.Column [2] .Data Type = Type32 (Int32); // After this wb.Worksheets.Add (DT);  

Comments

Popular posts from this blog

ios - How do I use CFArrayRef in Swift? -

eclipse plugin - Run java code error: Workspace is closed -

c - Error on building source code in VC 6 -