How do I use Apache POI to pre-define an auto-filter region in an Excel 2007 document?
A small code example or link would be nice.
//include poi-3.7.jar,ojdbc.jar in classpath
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.Statement;
import java.io.*;
import java.net.*;
import javax.servlet.*;
import javax.servlet.http.*;
import org.apache.poi.hssf.usermodel.*;
import org.apache.poi.hssf.util.HSSFColor;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.CellStyle;
import org.apache.poi.ss.usermodel.IndexedColors;
public class ExcelCreator{
public static void createExcel(String anySql,OutputStream out) throws Exception{
Connection conn=getOracleConnection();
String userSql1="select * from tab";
String userSql2="select * from tab";
String[] sqls={userSql1,userSql2,anySql};
String[] workSheetNames={"User","Manager","Any"};
HSSFWorkbook wb = new HSSFWorkbook();
CellStyle style1 = wb.createCellStyle();
CellStyle style2 = wb.createCellStyle();
for(int i=0;i