We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

No Such Method Error when Writing to XLSX under Java 1.5

Running the following program under Java 1.6 works fine but under 1.5 (using version 1.5 jars) throws an exception.

import java.io.;
import com.aspose.cells.
;

public class AsposeXLSXWriteTest
{
public static void main(String[] args) throws FileNotFoundException, Exception
{
FileInputStream fis = new FileInputStream(“C:\testXLS.xls”);
Workbook wb=new Workbook(fis,new LoadOptions(LoadFormat.AUTO));
fis.close();

wb.getWorksheets().get(0).getCells().get(1,0).setValue(“This works!”);
FileOutputStream fos = new FileOutputStream(new File(“C:\testXLSX.xlsx”));
wb.save(fos, new XlsSaveOptions(SaveFormat.XLSX));
fos.close();
}
}


Exception in thread “main” java.lang.NoSuchMethodError: com.ctc.wstx.api.WriterConfig.doAddSpaceAfterEmptyElem(Z)V
at com.aspose.cells.b.a.h.k.a(Unknown Source)
at com.aspose.cells.b.a.h.k.(Unknown Source)
at com.aspose.cells.b.a.h.k.(Unknown Source)
at com.aspose.cells.fA.a(Unknown Source)
at com.aspose.cells.fA.p(Unknown Source)
at com.aspose.cells.fA.a(Unknown Source)
at com.aspose.cells.fz.a(Unknown Source)
at com.aspose.cells.Workbook.a(Unknown Source)
at com.aspose.cells.Workbook.save(Unknown Source)
at com.du.sjk.scrap.AsposeXLSXWriteTest.main(AsposeXLSXWriteTest.java:16)

Hi,


Please make sure that you have set all other dependencies jars (e.g., dom4j-1.6.1.jar, bcprov-jdk15-146.jar,woodstox-core-asl-4.0.8.jar, stax2-api-3.0.2, jsr173_1.0_api.jar) to class path. I have tested your case with our latest version, v7.0.1 using my JDK1.5 version, it works fine. Also for reference about all the JARs, see the “README_LIB.txt” file present in the release archive of v7.0.1:
http://www.aspose.com/community/files/72/java-components/aspose.cells-for-java/entry329168.aspx

Here is my sample code:
FileInputStream fis = new FileInputStream(“testXLS.xls”);
Workbook wb=new Workbook(fis,new LoadOptions(LoadFormat.AUTO));
fis.close();
wb.getWorksheets().get(0).getCells().get(1,0).setValue(“This works!”);
FileOutputStream fos = new FileOutputStream(new File(“outtestXLSX1.xlsx”));
wb.save(fos, new OoxmlSaveOptions(SaveFormat.XLSX));
fos.close();


Thank you.