Excel error on writing into excel file Module20 | Selenium Forum
M
Posted on 04/01/2016
Hi Team,

When i try to add sheet or value in the excel field, i am unable to open xlsx file.
-------------------------------
@Override
public void onFinish(ISuite suite)
{
if(resultTable!=null){
System.out.println("Finishing suite "+suite.getName());
System.out.println(resultTable);
resultTable=null;
}
//Write results in xlsx
Xls_Reader xls=new Xls_Reader(resultFilePath);
xls.addSheet(suite.getName());



}
-----------------------------
Console:
{loginTest Iteration 1=Skipping the test LoginTestinside the suitePortfolioSuite}
java.lang.NoClassDefFoundError: org/openxmlformats/schemas/spreadsheetml/x2006/main/CTDxfs$1
at org.openxmlformats.schemas.spreadsheetml.x2006.main.CTDxfs.<clinit>(Unknown Source)
at org.openxmlformats.schemas.spreadsheetml.x2006.main.CTDxfs$Factory.newInstance(Unknown Source)
at org.apache.poi.xssf.model.StylesTable.writeTo(StylesTable.java:362)
at org.apache.poi.xssf.model.StylesTable.commit(StylesTable.java:377)
at org.apache.poi.POIXMLDocumentPart.onSave(POIXMLDocumentPart.java:177)
at org.apache.poi.POIXMLDocumentPart.onSave(POIXMLDocumentPart.java:181)
at org.apache.poi.POIXMLDocument.write(POIXMLDocument.java:214)
at com.testing.framework.DDF.util.Xls_Reader.addSheet(Xls_Reader.java:355)
at com.testing.framework.DDF.CustomListener.onFinish(CustomListener.java:98)
at org.testng.SuiteRunner.invokeListeners(SuiteRunner.java:204)
at org.testng.SuiteRunner.run(SuiteRunner.java:264)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1185)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1181)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1110)
at org.testng.TestNG.run(TestNG.java:1018)
at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:112)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:205)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:176)
Caused by: java.lang.ClassNotFoundException: org.openxmlformats.schemas.spreadsheetml.x2006.main.CTDxfs$1
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 20 more


Thanks
Manoj

M
Replied on 04/01/2016

first of all update your POI API versions and then create a new xlsx file. and try to add sheet in the new file.


M
Replied on 10/01/2016

Thanks . I have updated the version and excel sheet working fine.