Setting filter on headers of an Excel sheet via POI

前端 未结 5 802
一个人的身影
一个人的身影 2021-01-30 21:06

I generate a sheet, pretty bog standard headers and columns of data.

I want to turn on the \"Filter\" function for the sheet, so the user can easily sort and filter the

5条回答
  •  梦谈多话
    2021-01-30 21:36

    Use sheet.setAutoFilter(CellRangeAddress.valueOf("B1:H1"));

    We have to specify only the header cells of the tabular data. Here in my example header starts from cell B1 and ends at cell H1.
    Excel will automatically find the data below it and show it in the filter options.

提交回复
热议问题