Spire.XLS is a professional Excel API that enables developers to create, manage, manipulate, convert and print Excel worksheets. Get free and professional technical support for Spire.XLS for .NET, Java, Android, C++, Python.

Mon Jan 13, 2020 7:55 am

hello,
I have a macro-enable file which runs macros when we open a worksheet.
I was trying to download this .xlsm i.e macro-enabled worksheet using spire.xls but it was giving security warning.
1. Can we enable this setting using spire.xls?
2. Can we save this macro-enabled file into PDF format using spire.xls?
Attachments
Capture.PNG
enable macro warning
Capture.PNG (11.07 KiB) Viewed 2456 times

aksh0614
 
Posts: 23
Joined: Mon Jul 02, 2018 3:53 am

Mon Jan 13, 2020 9:41 am

Hi,

Thanks for your inquiry.
1. I loaded and saved a .xlsm file, when opening there is no security warning. Please provide your input file and the code you were using for further investigation.
2. As per my understanding, you want to convert the file which has run the Macro to PDF. If so, sorry that our Spire.XLS doesn't support running Macro. If I misunderstand, please provide detailed information along with the input Excel and the excepted PDF.

Sincerely,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Mon Jan 13, 2020 12:06 pm

Below is the code we are using to load a file from the stream and download that file using return file

Code: Select all

MemoryStream memory = new MemoryStream();
//Stream stream = "This stream contains .xlsm file";
 Workbook book = new Workbook();
book.LoadFromStream(stream);
Worksheet sheet = book.Worksheets[1];
sheet.InsertDataTable(dataTable, true, 1, 1);
book.SaveToStream(memory);
return File(memory , "application/vnd.ms-excel.sheet.macroEnabled.12", "Filename.xlsm");


aksh0614
 
Posts: 23
Joined: Mon Jul 02, 2018 3:53 am

Tue Jan 14, 2020 2:35 am

Hi,

Thanks for your information.
I have noticed the issue. After further investigation, I am afraid our product cannot control that settings, since it is controlled by the MS Excel tool. If you set following settings, when opening there will be no security warning. Hope you could understand.

Sincerely,
Betsy
E-iceblue support team
Attachments
Macro setting.png
Macro setting.png (25.47 KiB) Viewed 2416 times
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Return to Spire.XLS