Can JSP using apachi POI handle the very complicated JSP?



Share on Google+Share on Google+

mike wang
Can JSP using apachi POI handle the very complicated JSP?
1 Answer(s)      6 years and 4 months ago
Posted in : JSP-Servlet

Can the following jsp handle the very complicated excel: such as, multiple sheet,

tree structure, with chart in the excell file, etc.

<[email protected] import="*"%>
<[email protected] import="java.util.*"%>
<[email protected] import="org.apache.poi.xssf.usermodel.XSSFSheet"%>
<[email protected] import="org.apache.poi.xssf.usermodel.XSSFWorkbook"%>
<[email protected] import="org.apache.poi.xssf.usermodel.XSSFRow"%>
<[email protected] import="org.apache.poi.xssf.usermodel.XSSFCell"%>
<table border="1">
    short a=0;  
    short b=1;  
    short c=2;  
    short d=3;  
    int i=0;    
        String   value1="", value2="",value3=" ", value4="";    
        String filename ="C:/hello.xls";     
        if(filename != null && !filename.equals("")){
        FileInputStream fs =new FileInputStream(filename);    
        XSSFWorkbook wb = new XSSFWorkbook(fs);   
        for(int k = 0; k < wb.getNumberOfSheets(); k++){    
         int j=i+1;    
         XSSFSheet sheet = wb.getSheetAt(k);    
         int rows  = sheet.getPhysicalNumberOfRows();    
         for(int r = 0; r < rows; r++){    
         XSSFRow row   = sheet.getRow(r);    
         int cells = row.getPhysicalNumberOfCells();    
            XSSFCell cell1  = row.getCell(a);      
            value1 = cell1.getStringCellValue();   
            XSSFCell cell2  = row.getCell(b);     
            value2 = cell2.getStringCellValue();    
            XSSFCell cell3  = row.getCell(c);      
            value3 = cell3.getStringCellValue();    
            XSSFCell cell4  = row.getCell(d);     
            value4 = cell4.getStringCellValue();    
}catch(Exception e){  
View Answers

May 19, 2011 at 1:32 PM

Mostly it can solved.


Related Tutorials/Questions & Answers: