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

Free Support Forum - aspose.com

Lost Macros

Hi,

When I make a copy of a xls file that has macros in it, the macros are missing in the copy.

I call the openWorkBookCopy(...) method, add some cell data, then call saveWorkBook(...).

I get everything else in the copy such as images and formatting. The copy looks great, but the macros are missing.

Any ideas?

Thanks!

(Below is my helper class with the methods I call)

public void openWorkBookCopy(String sourceFileUrl)
throws IOException
{
URL inUrl = new URL(sourceFileUrl);
URLConnection inConnection = inUrl.openConnection();
inConnection.setDoInput(true);
InputStream inStream = null;
try
{
inStream = inConnection.getInputStream();
Workbook sourceWorkbook = new Workbook();
workbookCopy = new Workbook();
sourceWorkbook.open(inStream);
workbookCopy.copy(sourceWorkbook);
}
finally
{
if(inStream != null)
inStream.close();
}
}

public void saveWorkBook(String fileName) throws IOException
{
if(workbookCopy!=null)
workbookCopy.save(fileName);//,FileFormatType.EXCEL97);
}

Hi,

We have supported the feature (copying workbooks with macros) now for your requirement.

We will provide a fix soon.

Thank you.

Hi,

Please try this attached fix, thank you.

Hi,

Thanks for the fast reply! I just now tried to use new jar but have license issues now.

java.lang.UnsupportedClassVersionError: (com/aspose/cells/License) bad major version at offset=6

Need new .lic ?

Thanks

Hi,

We will check your issue and get back to you soon.

Thank you.

Hi,

Which version of JDK/JVM are you using? I think maybe you are using 1.4, please try this attached version for JDK1.4, thank you.

Hi,

Yes, that was it.

I should have specified which jvm we are using.



Thanks for the fix!