简体   繁体   English

如何在Java的Aspose单元格中的行上应用过滤器

[英]How to apply filters on rows in aspose cells for java

My excel file would have two columns - Type and value.After data has been inserted using smart markers, I want to add all the values belonging to the same type . 我的excel文件有两列-类型和值。使用智能标记插入数据后,我想添加属于同一类型的所有值。 How can this be done? 如何才能做到这一点? Auto filter require range which I don't know as my excel file is populated with values dynamically. 自动筛选所需的范围是我不知道的,因为我的excel文件是动态填充值。

For applying auto-filters, I think you do not actually need to specify the full range (with specific number of rows), you would only require to mention the columns (eg "A1:B1") on which you are going to apply filters. 对于自动过滤器,我认为您实际上不需要指定整个范围(具有特定的行数),只需提及要在其上应用过滤器的列(例如“ A1:B1”) 。 So, once your data is populated based on Smart Markers, you will make auto-filters on and even add your custom filter (for your specific type) accordingly, see the sample code segment below: eg Sample code: 因此,一旦基于智能标记填充了数据,您将启用自动过滤器,甚至相应地添加自定义过滤器(针对您的特定类型),请参见下面的示例代码段:例如,示例代码:

............

    Worksheet worksheet = worksheet.getWorksheets().get(0);
    AutoFilter autoFilter = worksheet.getAutoFilter();
    autoFilter.setRange("A1:B1");
    autoFilter.addFilter(0, "MyType");
    autoFilter.refresh();

.........

Hope, this helps a bit. 希望这个对你有帮助。

I am working as Support developer/ Evangelist at Aspose. 我在Aspose担任技术支持/开发人员。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM