What i need is to compare or search for a string in a sheet name..
I mean, the excel file might have more than one sheet, but only the sheets with a specific string let said
only sheets named "FORMATO SIVE 04" are going to be processed...
I'm debugging like crazy and I'm getting confused... my code it's like this
Workbook eworkbook = WorkbookFactory.create(Archivo);
int totalsheet = eworkbook.getNumberOfSheets();
System.out.println("fuerawhile"+totalsheet);
sheetName=new String[totalsheet];
//String nombrehoja = eworkbook.getSheetName(0).toString();
//System.out.println(nombrehoja);
Sheet sheet = null;
while(i<totalsheet){
sheetName[i] = eworkbook.getSheetName(i);
System.out.println("Antes IF :" + sheetName[i]);
FORMATO = sheetName[i];
if(FORMATO == "FORMATO SIVE 04"){
flag = true;
}
if(flag){
System.out.println("dentroIF : " + sheetName[i]);
sheet = eworkbook.getSheet(sheetName[i].toString());
System.out.println("Exito");
}
else if (!flag){
System.out.println("Error");
}
System.out.println("dentrowhile : " + sheetName[i]);
i++;
}
but it doesnt give me true :(
does anybody has any idea?
I think this is too easy but I'm having a lot of time in this and i think I'm right :(
Thanks in advance