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

Free Support Forum - aspose.com

Cells.ExportDataTable Is it a bug?


We have custom formated the number cells to round up/round down for some cells.
So if you enter 0.99 it will be displayed as 1 and 0.43 as 0.

But sheet.Cells.ExportDataTable or sheet.Cells.ExportDataTableAsString is exporting the displayed value rather than the actual value in the cell? Is that a bug? or Do we have flags to get the actual value or the formatted value?


Could you post your template file here, we will check your issue soon.

Thank you.


Attached a sample template has been conditional formatted Custom > #,##0_ ;[Red]-#,##0

So When I enter 10.99 it shows as 11 and 9.4 as 9

And i expected 10.99/9.4 when i do datatable export.


Please try the attached version.

I have tested with it using the following sample code and it works fine.

Sample code:

Workbook workbook = new Workbook(“e:\test\TemplateTest.xls”);

Worksheet worksheet = worksheet = workbook.Worksheets[0];

DataTable dt = worksheet.Cells.ExportDataTable(0, 0, worksheet.Cells.MaxDataRow + 1, worksheet.Cells.MaxDataColumn + 1);

int index = workbook.Worksheets.Add();
Aspose.Cells.Worksheet worksheet2 = workbook.Worksheets[index];

worksheet2.Cells.ImportDataTable(dt,false, “A1”);


Thank you.

I used ExportDataTableAsString and -999.99 read as -1000 ( the formatted display)

Hi Naren,

A cell in an Excel file has a Cell Value & a Cell string value. When you use ExportDataTableAsString, it returns the string value of the cell on the other hand if you use ExportDataTable it will return you the cell value of the cell. So, you can use ExportDataTableAsString method in order to get string value (displayed value) & ExportDataTable in order to get actual value of the cell.



Thanks for your quick turnaround. But the problem there are 3 rows. The possible values Yes/No or a valid number. So the export datatable fails. Anyway i as a quick fix, i am trying to work around with some conditional formatting stuff.