可以读取过滤后的行数据吗?
场景
- 拥有一个包含表和数据的现有 Excel XLSX 文件。
- 该表已被过滤。例如,如果没有过滤器,它会有 5 行,并且当前被过滤为只有 3 行可见。
- 我想使用 EPPlus 从 XLSX 文件中读取经过严格筛选的 10 行。
这是未过滤时表格的样子:
这是过滤后表格的样子:
问题
是否可以通过以下方式仅获取那些过滤后的行C# 中的 EPPlus?
我已经在 EPPlus 存储库以及 Google 中搜索了各种问题,但没有找到任何一个类似的问题/答案。
似乎这可以通过 PIA 和 Excel Interop 实现,但我想在不依赖任何 Office 的情况下完成此操作。
Scenario
- Having an existing Excel XLSX file with a table and data.
- This table is filtered. E.g. it would have 5 rows without a filter and is currently filtered to only have 3 rows visible.
- I want to use EPPlus to read that very filtered 10 rows from the XLSX file.
This is how the table could look like when being unfiltered:
And this is how the table could look like when being filtered:
Question
Is it possible to get only those filtered rows via EPPlus in C#?
I've searched through various issues in the EPPlus repository as well as through Google in general and did not find one single similar question/answer.
It seems that this is possible via PIA and Excel Interop, but I want to do it without any Office dependency.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我还在 EPPlus 的 GitHub 页面上提出了这个问题,并得到了一个可行的答案< /a>:
必须检查
ExcelRow.Hidden
属性是否为 false,才能仅获取未过滤的可见行。例子:
I've also asked the question on EPPlus' GitHub page and got a working answer:
One has to check if the
ExcelRow.Hidden
property is false to get only the unfiltered, visible rows.Example: