aspose.cell 读取文件 报乱码
不废话直接上代码 主要注意是 红色代码部分
Aspose.Cells.TxtLoadOptions lo = new TxtLoadOptions();
lo.Encoding = Encoding.Default;
//创建一个Workbook和Worksheet对象
Worksheet wkSheet = null;
Workbook wkBook = new Workbook(strFileName,lo);
wkBook.FileFormat = FileFormatType.CSV;
wkSheet = wkBook.Worksheets[SheetIndex];
Cells cells = wkSheet.Cells;
//读取标头数据
DataTable dt = cells.ExportDataTableAsString(SheetIndex, HeaderRowIndex, cells.MaxDataRow + 1, cells.MaxColumn + 1, true);
//释放对象
wkSheet = null;
wkBook = null;
//返回数据
return dt;
转载于“凡的世界”博客