Aspose.Cells 日期筛选刷新时,隐藏的行不正确。
代码:
var wb = new Workbook("input.xlsx");
var filter = wb.Worksheets[0].AutoFilter;
filter.AddDateFilter(0, DateTimeGroupingType.Month, 2023, 1, 0, 0, 0, 0);
filter.AddDateFilter(0, DateTimeGroupingType.Month, 2023, 9, 0, 0, 0, 0);
filter.Refresh(true);
Console.WriteLine("Sheet1: Select 2023-01 and 2023-09");
var cells = wb.Worksheets[0].Cells;
var rows = cells.Rows;
for (int rowIndex = 1; rowIndex < 9; rowIndex++)
{
Console.WriteLine($"Date {cells[rowIndex, 0].DisplayStringValue} hidden: {rows[rowIndex].IsHidden}");
}
Console.WriteLine("Sheet2: Select 2023-08-09 and 2023-08-11");
wb.Worksheets[1].AutoFilter.Refresh(true);
cells = wb.Worksheets[1].Cells;
rows = cells.Rows;
for (int rowIndex = 1; rowIndex < 12; rowIndex++)
{
Console.WriteLine($"Date {cells[rowIndex, 0].DisplayStringValue} hidden: {rows[rowIndex].IsHidden}");
}
样例文件:
input.zip (9.0 KB)