Hello
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;
try
{
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);
workbook.Close();
}
#endregion
}
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.
Thanks.