We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Problem opening .xlsm Excel macro file using XlsIO UWP

Thread ID:





127861 Dec 14,2016 11:01 AM UTC Dec 21,2016 12:04 PM UTC UWP 3
Tags: XlsIO
Kasper Mathiesen
Asked On December 14, 2016 11:01 AM UTC


Thanks for a great product.

Im having trouble opening a excel file with macro in a UWP app.

My code looks like this:

using (ExcelEngine excelEngine = new ExcelEngine())
                excelEngine.Excel.DefaultVersion = ExcelVersion.Excel2016;
                IApplication application = excelEngine.Excel;

                    var uri = new Uri("ms-appx:///Docs/Cert.xlsm");
                    var cert = await StorageFile.GetFileFromApplicationUriAsync(uri);
                    application.SkipOnSave = SkipExtRecords.None;
                    application.SkipOnSave = SkipExtRecords.CopySubstreams;
                    Stream stream = await cert.OpenStreamForReadAsync();
                    IWorkbook workbook = await excelEngine.Excel.Workbooks.OpenAsync(stream, ExcelOpenType.Automatic);
                    IWorksheet worksheet = workbook.Worksheets[0];
                    worksheet.Range["B2"].Text = OrderNr;
                    //worksheet.Range["E6"].Text = Kunde;
                    worksheet.Range["B5"].Text = Skib;
                    #region Save the Workbook
                    StorageFile storageFile;
                    storageFile = await suscces.CreateFileAsync(OrderNr + " MV" + Skib + " Certificates.xlsm", CreationCollisionOption.ReplaceExisting);
                    if (storageFile != null)
                        //Saving the workbook
                        await workbook.SaveAsAsync(storageFile);
                catch (Exception)



It fails on IWorkbook workbook = await excelEngine.Excel.Workbooks.OpenAsync(stream, ExcelOpenType.Automatic);

If I change the file to an xlsx excel file without macros it works no problem. 

I cant find anywhere that xlsm should not be included in the UWP version.


Sridhar Sukumar [Syncfusion]
Replied On December 15, 2016 12:29 PM UTC

Hi Kasper, 


Thank you for contacting Syncfusion support. 


We are unable to reproduce the issue from our side. We have shared a simple sample for your reference.  which can be downloaded from following location. 


Sample link:  



Kindly modify the sample to reproduce the issue and share us the modified sample along with the issue reproducing input files which will be helpful for us to give you a prompt solution at the earliest. 


Please let us know if you have any concerns. 



Sridhar S. 

Kasper Mathiesen
Replied On December 20, 2016 10:03 AM UTC

Hello Sridhar

Thank you for your reply I have downloaded the sample file and can confirm that it works as it should with the Sample.xlsm.

How ever if i try inputting my xlsm fil it gives the following exceptions:

Exception thrown: 'System.Exception' in mscorlib.ni.dll
Exception thrown: 'System.Exception' in mscorlib.ni.dll
Exception thrown: 'System.AggregateException' in mscorlib.ni.dll

It is a big Excel file with multiple tabs and macros, so that might be the cause.

Sridhar Sukumar [Syncfusion]
Replied On December 21, 2016 12:04 PM UTC

Hi Kasper, 
Thank you for updating us. 
We also suspect that the issue might be raised from your input file. So, we kindly request you to share the Excel document along with complete stack trace of the exception which will be helpful for us to give you a prompt solution at earliest. 
Note: We use the shared document only for validation purpose. We will delete the document after completing the validation. 
Sridhar S. 


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon