我的导出代码:
Aspose.Cells.LoadOptions opt = new Aspose.Cells.LoadOptions();
opt.LoadFilter = new Aspose.Cells.LoadFilter(Aspose.Cells.LoadDataFilterOptions.CellValue | Aspose.Cells.LoadDataFilterOptions.Style);
opt.MemorySetting = Aspose.Cells.MemorySetting.MemoryPreference;
using (Aspose.Cells.Workbook lswo = new Aspose.Cells.Workbook(filePath, opt))
{
foreach (Aspose.Cells.Worksheet worksheet in lswo.Worksheets)
{
string slsbm = worksheet.Name;
worksheet.Cells.MemorySetting = Aspose.Cells.MemorySetting.MemoryPreference;
worksheet.Cells.DeleteBlankRows();
worksheet.Cells.DeleteBlankColumns();
int totalRows = worksheet.Cells.MaxDataRow + 1;
int maxColumns = worksheet.Cells.MaxDataColumn + 1;
if (maxColumns == 0 || totalRows == 0)
continue;
Aspose.Cells.ExportTableOptions exportTableOptions = new Aspose.Cells.ExportTableOptions();
exportTableOptions.ExportColumnName = true;
exportTableOptions.SkipErrorValue = true;
System.Data.DataTable dataTable = worksheet.Cells.ExportDataTable(0, 0, worksheet.Cells.MaxRow + 1, worksheet.Cells.MaxDataColumn + 1, exportTableOptions);
dataTable.TableName = worksheet.Name;
}
}