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

Free Support Forum - aspose.com

Issues on Aspose.cell java while creating XLSM

Hi Team,

I am generating an XLSM workbook from ByteArrayInputStream and using com.aspose.cells.VbaModule to embedded a macro code in the workbook. Getting attached error while enable the content in the workbook downloaded from the server and macros are not working.
Capture.JPG (20.8 KB)

Workbook is working as expected when i download from tomcat server in developer machine.
Configurations of Server & developer machine is given below

Server
Linux OS
File encoding is UTF-8
Tomcat v8

Developer machine
Windows OS
File encoding is Cp1252
Tomcat v8

In a glance i believe its an encoding issue.
Can i set encoding for a workbook while i create the work book? unfortunately i couldn’t find any methods or options which insist encoding for XLSM.
I am using Aspose aspose-cells.16.11.0.jar

Kindly let me know how it can be done.

Thanks

@Manoj_Velliyatt_in_e

Please try the Java code given in this article (.NET article was also given) and generate the XLSM in your developer and server machine and compare them. Also provide them to us for comparison.

Hopefully, the code will replicate the issue and we will then log it and fix it.

Article Links:

Thanks shakeel

Able to replicate the issue with the sample code provided. The server_sample_out.xlsm is throwing a visual basic system error.

attached zip file has the below files.

a) File from developer machine -> Developer_Sample_out.xlsm
b) File from server machine -> Server_Sample_out.xlsm

OrginalFiles.zip (19.7 KB)

@Manoj_Velliyatt_in_e

Please run the code as a standalone console application on your server and let us know if you still find the problem. Let us know your feedback.

When i ran it as a standalone program the Macro’s are working as expected in both Linux & Windows, but still the issue persist while i use Server. I am using Tomcat 8 as JEE container, & using Spring components for developing the application.

can you give me some pointers why Aspose macro’s not working on a web application. ?

@Manoj_Velliyatt_in_e

Please try one of the following JVM option

  • Aspose.Cells.Disable=SunFontManager

OR

  • java.awt.headless=true

and see if it makes any difference at your end.

@Manoj_Velliyatt_in_e

We found, you are using the older version (i.e. 16.11.0) and this issue has already been fixed in latest version. Please download and try the latest version and your issue will be resolved with it. Let us know your feedback.

I have tried both options JVM arguments & upgrade to 17.9 no luck as of now. One interesting thing when i created a new JEE project and added your code snippet to create the XLSM file without Spring components, it is working as expected. I am not sure anything has to be done on Spring for Aspose to work. your thoughts please

@Manoj_Velliyatt_in_e

Please share the two XLSM files.

1 - The XLSM file generated on your server but it is corrupt.
2 - The XLSM file generated on your server but it is good.

For 2, I am referring to this.


Please run this code and check what version number of Aspose.Cells, it is showing.

Java

//Print the Aspose.Cells version which is running
System.out.println("Aspose.Cells for Java v" + CellsHelper.getVersion());

The code snippet of creating XLSM should be same as given in the article. Please also share your code which you are running on the server.

Apologies for late reply Shakeel , issue got resolved after upgrading to 17.9 Aspose. Dev War’s were not picking the latest Aspose versions.
Thanks a lot for the overwhelming support

@Manoj_Velliyatt_in_e,

Good to know that your issue is sorted out by the latest version/fix. Feel free to contact us any time if you need further help or have some other issue or queries, we will be happy to assist you soon.