java - Autofilter in apache POI range not working -


does know wrong following filter trying set report generated apache poi?

i'm using code:

sheet.setautofilter(cellrangeaddress.valueof("a4:a6")); 

to result:

filters applied

however, when click arrow filter results value "average" possible result in dropdown list.

filter list

is there i'm missing here?

simply add empty row between data area , footer row. data area can limited empty rows , columns/header.

although you've selected a4:a6, a4 marked autofilter ... i'm not sure, think, can achieve horizontal autofilter via vba. setautofilter should a4:b4, mark header , not data area.

(tested poi 3.9, libre office 4.0)

import java.io.*; import org.apache.poi.hssf.usermodel.*; import org.apache.poi.ss.util.*;  public class autofilter {     public static void main(string[] args) throws exception {         hssfworkbook wb = new hssfworkbook();         hssfsheet sheet = wb.createsheet();         sheet.createrow(3).createcell(0).setcellvalue("protocol number");         sheet.createrow(4).createcell(0).setcellvalue("demonnumber1");         sheet.createrow(5).createcell(0).setcellvalue("demonnumber2");         sheet.createrow(6).setzeroheight(true);         sheet.createrow(7).createcell(0).setcellvalue("average");         sheet.setautofilter(cellrangeaddress.valueof("a4:b4"));         fileoutputstream fos = new fileoutputstream("autofilter.xls");         wb.write(fos);         fos.close();     } } 

Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -