I'm trying to read the used range of an Excel file with Spreadsheet Gear and I've currently got it set up to do this:
var workbook = Factory.GetWorkbookSet().Workbooks.OpenFromStream(fileStreamInput);
var sheet = workbook.Worksheets[0];
var values = sheet.Cells[sheet.UsedRange.Address].Value;
The Excel file will be uploaded by people using different column formatting so this code needs to type-independent... except for dates. This code pulls in the double-representation of dates that Excel stores them as and I don't want that. I'm aware that the following line will convert that double into a date:
workbook.NumberToDateTime(dateAsADouble);
However, that assumes that I know which cell is date-formatted beforehand and I never will. I'd like to be able to convert all of the cells stored in values
that are date-doubles using this method, ideally without looping through every value individually but I will accept such an answer if there's nothing else. I thought I might be able to use Linq but it seems that SpreadsheetGear's IRange
class doesn't support Linq.
Is there a way to do this? Perhaps a method that tests whether a cell is a date-double? I haven't found anything like this in SpreadsheetGear's API.