我正在使用EPPlus将数据集导出到Excel中。当我在工作簿中有1个工作表时没有问题。当我添加其他工作表时,工作表空白单元格自动添加过滤器,如下所示。避免这种不需要的过滤器的任何解决方案?
using (var package = new ExcelPackage(newFile))
{
DataTable sourceTable = dsSource.Tables[0];
TableStyles tableStyles1 = OfficeOpenXml.Table.TableStyles.Custom;
ExcelWorksheet worksheet1 = package.Workbook.Worksheets.Add(sheetName +
"1");
ExcelRangeBase range1 = worksheet1.Cells[1,1, sourceTable.Rows.Count - 1,
sourceTable.Columns.Count - 1].LoadFromDataTable(sourceTable, true,
tableStyles1);
sourceTable = dsSource.Tables[1];
TableStyles tableStyles2 = OfficeOpenXml.Table.TableStyles.Custom;
ExcelWorksheet worksheet2 = package.Workbook.Worksheets.Add(sheetName +
"2");
ExcelRangeBase range2 = worksheet2.Cells[1, 1, sourceTable.Rows.Count - 1,
sourceTable.Columns.Count - 1].LoadFromDataTable(sourceTable, true,
tableStyles2);
package.Save();
}