I have an application which downloads excel sheet on button click, the data is filled from a ADO.NET data table. Now the problem is, few data columns are NULL in database, they don't print as NULL in excel cell, instead its blank. How do I fill NULL value in those excel cell?
Right now i'm looping through each column to see if the value is of Datetime(Code Below). Can something similar be done to assign NULL values by looping through each row and column cell?
int colWorkSheet1 = 0;
foreach (DataColumn data in dataTable1.Columns)
{
colWorkSheet1++;
if (data.DataType == typeof(DateTime))
{
worksheet1.Column(colWorkSheet1).Style.Numberformat.Format = "MM/dd/yyyy";// use "MM/dd/yyyy hh:mm:ss AM/PM"; for time and seconds
}
}
nulls when inserting data? Or use an helper that would check fordatetimeandnullbefore inserting the value maybe? - Rafalon