I am working with a large xlsm file, the file has many tabs and i want to parse a specific tab information.I am able to load the file using apache EventUsrerModel documentaion.But i am not able to get the specific tab information using XSSFReader and also i have used another APIs like XSSFWorkBook with OCPPackage, but it is failing me with heap space.Only XSSFReader is able to load the document into the system but i don't know how to get a specific tab information using it. Here i am giving the code i have upto now,
I am using a java class where i am setting the large file like ,
public class LargeExcelManager {
private OPCPackage pkg ;
public OPCPackage getPkg() {
return pkg;
}
public void setPkg(OPCPackage pkg) {
this.pkg = pkg;
}
public LargeExcelManager(String fileName)throws Exception {
openWorkbook(fileName);
}
private void openWorkbook(String fileName)throws Exception {
try {
System.out.println("Can be added now");
//File myFile = new File(fileName);
this.setPkg(OPCPackage.open(fileName));
} catch (Exception e) {
e.printStackTrace();
}
}
}
And here i am loading the document using XSSFReader,
public void startElement(String uri, String localName, String name,
Attributes attributes) throws SAXException {
try {
// c => cell
if(name.equals("c")) {
// Print the cell reference
System.out.print(attributes.getValue("r") + " - ");
String rowIndex = (attributes.getValue("r"));
// I have to ignore some rows here and get the data how can i do that ?
// Figure out if the value is an index in the SST
String cellType = attributes.getValue("t");
if(cellType != null && cellType.equals("s")) {
nextIsString = true;
} else {
nextIsString = false;
}
}
// Clear contents cache
lastContents = "";
}catch(Exception e) {
e.printStackTrace();
}
}
Is this is the wright way i am passing the sheet "Loan information" that i am getting to the process ?? If so can anyone tell me how i can get the the desired row information from it ???