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

Free Support Forum - aspose.com

java.lang.NoSuchFieldError: a Exception

Hi Team,


Please help us to resolve the Issue.Its very urgent for us.we are getting below error when we are trying to open Excel output.

Below is the Error we are getting.
java.lang.NoSuchFieldError: a
at com.aspose.cells.OoxmlSaveOptions.(Unknown Source)

we have used the below code for  Excel generation.

License lics = new License();
lics.setLicense(is);
writeWorkbook=new Workbook();
SaveOptions opt = (SaveOptions)new OoxmlSaveOptions();
opt.setSaveFormat(FileFormatType.XLSX);

Please let us know if we did any mistake.It will be very helpful for Us if you provide us the root cause for Above Issue.

So we can debug the Issue from our end also.

Thanks!
Chiranjeevi



Hi Chiranjeevi,


Thank you for contacting Aspose support.

Please pass the FileFormatType value in the constructor of OoxmlSaveOptions class as follow,

Java

SaveOptions opt = new OoxmlSaveOptions(FileFormatType.XLSX);

Please feel free to write back in case you need our further assistance.

Hi,


Please use our latest version i.e. Aspose.Cells for Java v8.0.1 and update your code segment a bit. I have tested your scenario/ case with the following sample code, it works fine. I have attached the output Excel file for your reference.
e.g
Sample code:

Workbook writeWorkbook=new Workbook();
SaveOptions opt = (SaveOptions)new OoxmlSaveOptions(SaveFormat.XLSX);
writeWorkbook.save(“testin1.xlsx”, opt);

Thank you.

Hi Team,


Thank you for your quick Response.Please let us know what will be the Root cause for Error.


Thanks!
Chiranjeevi

Hi,


We requested you to change your code segment as per suggested code. Your code segment cannot be compiled with the latest version as there is no SaveOptions.setSaveFormat() method now. Please change your code segment accordingly and it would work fine.

Also, you may even further simplify your code segment as following:
e.g
Sample code:

Workbook writeWorkbook=new Workbook();
writeWorkbook.save(“testin121.xlsx”, SaveFormat.XLSX);


Let us know if you still have any issue or confusion.

Thank you.
Hi Team,

we can't modify the segment which you have suggested.for that we need to update our jar files. By applying the latest jar may fix the issue or may not, it's a trial and error process by changing the jar file. it will affect through out our Application. Please advise if there are any reason for which you are asking us to use the latest JAR files.

Please advise us how we can overcome the error with older Syntax.

Thanks!
Chiranjeevi


Hi,


Well, it would be better if you could upgrade to latest version of the product as over the years, we included lots of enhancements and other fixes in new versions of the product. You do not need to change your codes much, only a little tweak for a single line of code as per my suggestion.

We are not sure why you are getting the error with your current version of the product (it might be a bug in your version as it works fine with latest versions of the product - not sure though). Anyways, if you want to stick with your older version, we suggest you to kindly try the sample lines instead:
e.g
Sample code:

Workbook writeWorkbook=new Workbook();
writeWorkbook.save(“testin121.xlsx”, SaveFormat.XLSX);

//OR

Workbook writeWorkbook=new Workbook();
writeWorkbook.save(“testin121.xlsx”, FileFormatType.XLSX);

if it makes any difference.

Thank you.