The value of the cell C1 should not be a string value.

Aspose.cells打开文件之后输出为DataTable,是将第一行作为数据类型判断,列具有混合数据集

错误代码

var cells = workbook.Worksheets[0].Cells;
var detailTable = cells.ExportDataTable(0, 0, cells.MaxRow + 1, cells.MaxColumn + 1, exportTableOptions);

正确代码

var cells = workbook.Worksheets[0].Cells;
var exportTableOptions = new ExportTableOptions { CheckMixedValueType = false, ExportColumnName = true, ExportAsString = true };
var detailTable = cells.ExportDataTable(0, 0, cells.MaxRow + 1, cells.MaxColumn + 1, exportTableOptions);

  

 

posted @ 2023-03-22 11:03  剑仙也风流  阅读(387)  评论(0编辑  收藏  举报