<%@ page import="org.apache.poi.hssf.usermodel.HSSFSheet"%> <%@ page import="org.apache.poi.hssf.usermodel.HSSFWorkbook"%> <%@ page import="org.apache.poi.hssf.usermodel.HSSFPrintSetup"%> <%@ page import="org.apache.poi.hssf.usermodel.HSSFRow"%> <%@ page import="org.apache.poi.hssf.usermodel.HSSFCell"%> <%@ page contentType="application/vnd.ms-excel" %> <%@ page import="java.io.*" %> <%@ page import="java.util.*" %> <% try{ HSSFWorkbook hwb = new HSSFWorkbook(); HSSFSheet sheet = hwb.createSheet("new sheet"); HSSFSheet sheet1 = hwb.createSheet("secondsheet"); for(int i=0;i<10;i++) { HSSFRow row = sheet.createRow((short)0+i); HSSFCell cell = row.createCell((short)0); cell.setCellValue(111111); HSSFCell cell1 = row.createCell((short)0); cell1.setCellValue(111111); HSSFCell cell2 = row.createCell((short)1); cell2.setCellValue(111111); HSSFCell cell3 = row.createCell((short)2); cell3.setCellValue(111111); HSSFCell cell4 = row.createCell((short)3); cell4.setCellValue(111111); } hwb.setRepeatingRowsAndColumns(0,0,2,-1,-1); hwb.setRepeatingRowsAndColumns(1,4,5,1,2); FileOutputStream fileOut = new FileOutputStream("c:\\excel\\reaptingRow.xls"); hwb.write(fileOut); fileOut.close(); out.println("Your excel file has been generated"); } catch ( Exception ex ) { } %>