ExceptionInvalid position for the last cell!!
I am getting the the fallowing exception with a sample Java program I wrote for evaluation purpose. Please contact me at
ipedruzz@datadirect.com and i will provide the xls files
java.lang.Exception: Invalid position for the last cell!!
at EasyXLS.ExcelDocument.a(SourceFile:4506)
at EasyXLS.ExcelDocument.a(SourceFile:4974)
at EasyXLS.ExcelDocument.a(SourceFile:4968)
at EasyXLS.ExcelDocument.easy_ReadExcelWorksheet_AsXML(SourceFile:4874)
at testexceljava.XLS.toXML(XLS.java:34)
In the same test application i am trying to export the excel file to XML but the result is not well formed
We are really intrigued by your product.
Ivan Pedruzzi
package testexceljava;
import java.io.FileInputStream;
import javax.xml.parsers.*;
import EasyXLS.*;
public class XLS {
public static void main(String[] args)throws Exception
{
try{
toXML("C:\\Samples\\books.xls");
}catch(Exception e){
e.printStackTrace();
}
toXML("C:\\Samples\\dr.xls");
System.out.println("done!");
}
static void toXML(String xslpath) throws Exception
{
System.out.println("Start " + xslpath);
ExcelDocument xls = new ExcelDocument();
String xmlpath = xslpath + ".xml";
FileInputStream file = new FileInputStream(xslpath);
xls.easy_LoadTemplateFile(file);
xls.easy_WriteXMLFile(xmlpath);
for (int i=0; i < xls.SheetCount(); i++){
ExcelWorksheet ws = (ExcelWorksheet)xls.easy_getSheetAt(i);
String xmlsheetpath = xslpath + "_" + ws.getSheetName() + ".xml";
System.out.println("Start " + xmlsheetpath);
xls.easy_ReadExcelWorksheet_AsXML(xmlsheetpath, ws);
System.out.println("Finished " + xmlsheetpath);
}
file.close();
System.out.println("Finished " + xslpath);
DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
builder.parse(xmlpath);
xls.Dispose();
}
}