Xls to xlsm file through aspose.cells python dotnet disables the active x checkboxes

I have used Aspose.Cells for Python via .NET so far, it is able to read and write the xlsm file, but doesnt retain active x controls and checkboxes which in turn corrupts my macros which is dependent on it.

code used is straightforward

#Aspose
lic = License()
lic.set_license(Asposelic)

    # load a  xlsm template
    workbook = Workbook(rpt_monthly_old.xlsm)

    # Get the first worksheet
    worksheet = workbook.worksheets[0]

    # Get the "A1" cell
    cells = worksheet.cells
    cell = cells.get("D11")


    # Write "Hello World" to  "A1" in the first sheet
    cell.put_value("Hello World")

    # save this workbook to XLSM
    workbook.save(rpt_monthly_win32_old.xlsm)

@psethu01

Please zip the source file and the output xlsm file, and share it to us.
We will check it soon.

Attaching the zipped xlsm file we are using as a template to load data and save.rpt_monthly_aspose_sample.zip (1.2 MB)

@psethu01,

Please also attach your output XLSM file, it will help us to evaluate your issue precisely on our end.

PS. please try using Aspose.Cells for Python via .NET 22.9 if you are not already using it.

@Amjad_Sahi
@Peyton.Xu
Yes, i am using the most latest version.
aspose-cells-python 22.10.
Attaching the output file as requested.rpt_monthly_win32_old.zip (1.2 MB)

@psethu01,

Thanks for the output file.

I checked your provided (output) file by opening it into MS Excel 2016 manually. Apparently, I found it behaves the same way as your source(input) file. The checkboxes and other objects are not disabled. Both input and output files are same. Could you elaborate which ActiveX controls and other objects are disabled and that are causing the macros to be corrupted, how to confirm it in MS Excel manually? You may also provide some screenshots to highlight the problematic areas for reference. We will check it soon.

@Amjad_Sahi please find the screenshot attached. I just ran the program again and get the same error.
I am also reattaching the ourput file again in case i sent the wrong file earlier.rpt_monthly_win32_old.zip (1.6 MB)
xlsm_screenshot.PNG (29.3 KB)

@psethu01,

I tested your scenario/case using latest version of Aspose.Cells for Python via .NET with your file using the following sample code:
e.g.
Sample code:

#import the python package
import aspose.cells
from aspose.cells import License,Workbook,FileFormatType
#load a  xlsm template
workbook = Workbook("rpt_monthly_aspose_sample.xlsm")

#Get the first worksheet
worksheet = workbook.worksheets[0]

#Get the "A1" cell
cells = worksheet.cells
cell = cells.get("D11")

#Write "Hello World" to  "A1" in the first sheet
cell.put_value("Hello World")

#save this workbook to XLSM
workbook.save("rpt_monthly_win32_old1.xlsm")

Please find attached the output XLSM file in the zipped archive (attached). Could you please open it into MS Excel and confirm if you see the issue with the output file?
files1.zip (2.7 MB)

@psethu01,

Nevermind, I can now see the issue (you pointed out) when opening the output file into MS Excel. I found MS Excel prompts an error dialog Run-time error ‘438’ regarding macros. In short, by re-saving the XLSM file having ActiveX controls corrupted the macros in the file. I have logged a ticket with an id “CELLSPYTHONNET-82” for your issue. We will look into it soon.

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

1 Like

@psethu01,

We are pleased to inform you that your issue has been resolved now. The fix will be included in our upcoming release (Aspose.Cells for Python via .NET v22.11) which is scheduled in the next month. You will also be notified when the next version is released.

1 Like

@psethu01 We have fixed this bug in the latest release 22.11.Please try, Thanks!

@xinyazhu it works now. Thanks a ton!!

@psethu01 You are welcome.