empty DateTime

Technical support for Spire.XLS

Moderators: iceblue support, Flash, Manager

empty DateTime

Postby lameb » Wed May 16, 2012 8:27 am


i want to try export to excel with an empty Date or Datetime and
in the Excel File i become "-1" to show?!

What can i do for an empty Cell by an empty Date?

best regards Lars
Posts: 10
Joined: Mon Feb 20, 2012 2:39 pm

Re: empty DateTime

Postby Eric » Thu May 17, 2012 7:45 am

Hi lameb,
We assumed that you are inserting to Excel cell with empty datatime value and then encouter this problem. Here we solve this problem by not insert any item to the cell if the datatime value is empty. Please check my codes below:
Code: Select all
 DateTime defaultdate=DateTime.Parse("0001-1-1 00:00:00");
            if (date!=defaultdate )
                sheet.Range["A1"].DateTimeValue = date;

Although it works fine in my side, but if you still have more information to present or any doubt about the solution, please feel free to contact us at anytime, we will try best to help you.

Posts: 17
Joined: Tue Apr 24, 2012 4:53 am

Return to Spire.XLS

Who is online

Users browsing this forum: No registered users and 0 guests