<%@ 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.HSSFPatriarch"%> <%@ page import="org.apache.poi.hssf.usermodel.HSSFClientAnchor"%> <%@ page import="org.apache.poi.hssf.usermodel.HSSFSimpleShape"%> <%@ 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"); HSSFPatriarch patriarch = sheet.createDrawingPatriarch(); HSSFClientAnchor a = new HSSFClientAnchor( 0, 0, 1023, 255, (short) 1, 0, (short) 1, 0 ); HSSFSimpleShape shape1 = patriarch.createSimpleShape(a); shape1.setShapeType(HSSFSimpleShape.OBJECT_TYPE_LINE); FileOutputStream fileOut = new FileOutputStream("c:\\excel\\createShape.xls"); hwb.write(fileOut); fileOut.close(); out.println("Your excel file has been generated"); } catch ( Exception ex ) { } %>