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

New Post: Any easy way to format a particular column to be 'number' instead of 'text' when converting a dataset into xls ?

$
0
0
 static void CreateExcelFromDataTable(DataTable dtExcel, string spName)
        {
            XLWorkbook wb = new XLWorkbook();

            wb.Worksheets.Add(dtExcel, "dtExcel");
            string fileName = "ExcelFiles/" + spName + "_" + DateTime.Now.ToString("MM.dd.yyyy") + ".xlsx";
            wb.SaveAs(fileName.Replace("usp_", ""));
        }
This works but for a particular column I need it to be formatted as 'number' when converted .. Any ideas ?

Viewing all articles
Browse latest Browse all 1877

Trending Articles