We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

DateTime not coming in on ExportDataTable

I have a sheet that I am reading and using the ExportDataTable method… I have a date in the sheet which is 4/1/2000 but for some reason the row in the DataTable is System.Double and the value is 36617.0

I could have sworn that I had seen something about this being handeled. Any ideas?

Thanks!

MS Excel save date and time as double values and show them according to the number format. Aspose.Excel can distinguish them when setting by standard format described at http://www.aspose.com/Products/Aspose.Excel/Api/Aspose.Excel.CellFormat.Number.html. Some custom number format also can be converted if it can be directly converted in dotnet framework. Aspose.Excel cannot convert others since there may be many many kinds of custom number formats.

If you really need to convert data in your designer file to DateTime value and Aspose.Excel cannot do it now, please send me your file and I will add a specific support in Aspose.Excel.

Hi, laurence. I sent you an email with an excel fileto test, but I know you prefer forum communication from my further testing it looks like the problem with version 1.8.8 is that if the first column the colums contain Nulls that it markes the colum as a string column and not a DateTime column.

Would it be possible to make it so that the column can still be a DateTime column even if it has nulls?

Thanks!

Hi Michael,

I got your file and I will investigate it right now.

Thanks for your waiting.

Thanks, Please let me know if you find anything wrong.

Hi Michael,

Sorry, I forgot to tell you it’s fixed. Please download fix 1.8.8.1 and have a try.

I just downloaded the latest fix (1.8.8) and now I’m getting an error when compiling:

c:\webs\ca\bin\Aspose.Excel.dll Cannot declare a namespace and a type both named 'ca’

We have a large namespace named ca (our top-level), so we cannot rename it.

Is there anything you can do about the name of whatever type object is ca within Aspose.Excel ?

Hi,

Please download the latest hotfix and have a try.

@Kluch, @mbuckleman,
Aspose.Cells has replaced Aspose.EXcel which is no more continued whereas the new product is completely aligned with the latest versions of MS Excel. You can perform all the tasks which are allowed while using MS Excel. This product also supports exporting data from the worksheet as demonstrated below:

// Instantiating a Workbook object
Workbook workbook = new Workbook(filePath);

// Accessing the first worksheet in the Excel file
Worksheet worksheet = workbook.Worksheets[0];

// Exporting the contents of 7 rows and 2 columns starting from 1st cell to DataTable
DataTable dataTable = worksheet.Cells.ExportDataTable(0, 0, 11, 2, true);

foreach (DataRow r in dataTable.Rows)
{
    foreach (DataColumn c in dataTable.Columns)
    {
        Double value = r.Field<Double>(c);
        Console.Write(value + "    ");
    }
    Console.WriteLine();
}

For more information on this topic please refer to the following link:
Export data from worksheeet

You can get the latest version of this product here:
Aspose.Cells for .NET (Latest Version)

For better understanding and testing a variety of features download a ready to run solution here.