Mark,

I was trying in the same way but in a different approach.

but my question is what if we have 40 -50 rows to check in the Excel sheet,
should we define its rules for all 40-50 rows with its cells, say in future
if the Excel has changed to 100 rows, is there any effective way to handle
this?

here is my sample code:

public boolean validateRows(Row row) {
    
        if(row.getRowNum() == 0) {
                        if(row.getCell(0).getCellType() == 
XSSFCell.CELL_TYPE_STRING) {
                                resultMap = new HashMap<String, HashMap<Date, 
HashMap<String,
ArrayList<Double>>>>();
                                compName = 
row.getCell(0).getStringCellValue().trim();
                                System.out.println("printing from row0 col0 = " 
+
row.getCell(0).getStringCellValue().trim());
                        } else { return validate =  false; }
                        
                } 
                else if(row.getRowNum() == 1) {
                        if(row.getCell(0).getCellType() == 
XSSFCell.CELL_TYPE_STRING) {
                                System.out.print("printing from row1 col0 = " +
row.getCell(0).getStringCellValue());
                        } else { return validate =  false; }
                        
                        for(int i=1; i<=25; i++) {
                                if(row.getCell(i).getCellType() == 
XSSFCell.CELL_TYPE_NUMERIC) {
                                        System.out.print(" " + 
row.getCell(i).getNumericCellValue());
                                        //TODO: should also check for values if 
they are from 1 to 25 ?
                                } else { return validate =  false; }
                        }
                        
                        if(row.getCell(26).getCellType() == 
XSSFCell.CELL_TYPE_STRING) {
                        
if(row.getCell(26).getRichStringCellValue().toString().equalsIgnoreCase("Sum"))
{
                                        System.out.println(" " +
row.getCell(26).getRichStringCellValue().toString());
                                } else { return validate =  false; }
                        } else { return validate =  false; }
                        
                } 
}

continued checking upto 14 rows and it works.


let me know your idea, how can I handle in this sutuation say like for 40
rows.


-- 
View this message in context: 
http://apache-poi.1045710.n5.nabble.com/How-to-check-if-Excel-values-are-matching-with-my-format-tp3379567p3384593.html
Sent from the POI - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to