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

Free Support Forum - aspose.com

Macros are no more used after migration from XLS to XLSX in .NET

Hi,

After migrating from Xls to Xlsx the document opens well, however in the first tab it is not possible to click on the image to use the macro.

The test was performed with Aspose Cells version 21.7.0

Can you look at this last problem?

Thank you Best regards

elements.zip (134.0 KB)

@ISIWARE,

I evaluated your issue using your template file with Aspose.Cells APIs. I then tested your scenario/case in MS Excel manually by opening the XLS file into it and then re-save to XLSX (Excel Workbook). I found MS Excel prompts error message that it won’t save VB project, so the output XLSX file will be macro-free workbook. Aspose.Cells does show the same behavior, so it is not an issue with the APIs.

Let us know if you still have any issue, we will check it soon.

Hi,

Indeed my test was not logical, I should have saved my file in XSLM.

I redid my scenario, after saving in XSLM, the macro seems to have been removed, what I do not understand, however, is that it is a macro that is not present in the original document.

Do you have an idea ?

cordially

elements.zip (131.8 KB)

@ISIWARE,

You are right this time. Please notice, I am able to reproduce the issue as you mentioned by converting your template XLS file to XLSM file format. The macros seems removed. I have logged a ticket with an id “CELLSNET-48359” for your issue. We will look into it soon.

Once we have an update on it, we will let you know.

@ISIWARE,

This is to notify you that the issue has been resolved. After performing QA and incorporating other extensions and fixes, we will provide you the fixed version within the next few days.

@ISIWARE,

Please try our latest fix .
Aspose.Cells21.7.5 For .Net2_AuthenticodeSigned.Zip (5.5 MB)
Aspose.Cells21.7.5 For .Net4.0.Zip (5.6 MB)
Aspose.Cells21.7.5 For .NetStandard20.Zip (5.6 MB)

The issues you have found earlier (filed as CELLSNET-48359) have been fixed in this update. This message was posted using Bugs notification tool by simon.zhao

Hi,

I just tested in Aspose Cell version 21.8.0 the problem is still present, the macro is missing from the file.
image.png (6.9 KB)

elements.7z (128.0 KB)

Thank you Best regards

@ISIWARE,

Please notice, the issue is reproduced with latest version/fix as you mentioned by converting your template XLS file to XLSM file format. The macros seems not working and no more in the output XLSM. I have logged a new ticket with an id “CELLSNET-49117” for your issue. We will look into it soon.

Once we have an update on it, we will let you know.

@ISIWARE,
Xlsx file can not contain macro codes, so if you save the file as xlsx file, macro codes are removed.
So if you want to make the macro works, please save it as xlsm file.

@ISIWARE,

Please note, if you save the workbook (which is loaded from the XLS template file) to XLSM file directly, the macro will be available in the resultant XLSM file. However, in your code, if the Workbook was saved as XLSX file first, then in such kind of situation, the macro in the Workbook object will be removed while saving, so later when saving this Workbook object to XLSM file again, there is no macros to be saved, so the functions using the macros cannot work any more in the resultant XLSM file.

In short, this code works fine:

Workbook workbook = new Workbook("e:\\test2\\OriginalDocument.xls");
workbook.Save("e:\\test2\\out12.xlsm", SaveFormat.Xlsm);

but this code does not work, I mean macros are not working anymore in output XLSM:

Workbook workbook = new Workbook("e:\\test2\\OriginalDocument.xls");
workbook.Save("e:\\test2\\out1.xlsx", SaveFormat.Xlsx);
workbook.Save("e:\\test2\\out12.xlsm", SaveFormat.Xlsm);