Aspose.Cells XLSM Save Issue with System.Drawing Error

Hello,

When using Aspose.Cells (Trial version) and loading up a .xlsm file and then calling workbook.Save with a macro enabled .xlsm file no errors occur, but upon opening the file a couple System.Drawing issues force the user to "repair". This issue does not occur when using using Microsoft.Office.Interop.Excel.

Env:
- Running on win 10
- Excel sheet is Excel 2016 .xlsm with embedded macros.

Repaired Records: Drawing from /xl/drawings/drawing1.xml part (Drawing shape)
Repaired Records: Drawing from /xl/drawings/drawing2.xml part (Drawing shape)

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
error019160_02.xmlErrors were detected in file 'C:\FlexiOutputTests\ExportTest\test.output.xlsm'Repaired Records: Drawing from /xl/drawings/drawing1.xml part (Drawing shape)Repaired Records: Drawing from /xl/drawings/drawing2.xml part (Drawing shape)

The code ran in Aspose to repro:
Workbook workbook = new Workbook(destFile);
workbook.Save(sFilePath + ".output.xlsm", SaveFormat.Xlsm);

code in interop that does work with causing the file an issue:
Application excelApp = new Application();
var workbook = excelApp.Workbooks.Open(destFile);
Microsoft.Office.Interop.Excel.Worksheet worksheet = new Microsoft.Office.Interop.Excel.Worksheet();

worksheet = workbook.Worksheets[1];
workbook.SaveAs(sFilePath + ".output.xlsm", Microsoft.Office.Interop.Excel.XlFileFormat.xlOpenXMLWorkbookMacroEnabled);
excelApp.Quit();

Hi there,


Thank you for contacting Aspose support.

I am afraid, we require the input sample to evaluate the case on our side, so please be kind enough to share the problematic sample with us. Please first create an archive (zip) of the sample then attached the .zip file with your next response. We will check the case and share our finding with you at earliest possible.

Hi again,


Thank you for sharing the sample.

I have evaluated the presented scenario while using the latest version of Aspose.Cells for .NET 17.02.2 (attached) and following piece of code. I am afraid, I am not able to replicate the said issue on my side, that is; the resultant XLSM can be loaded fine in Excel 2010 & 2016 without requiring to repair it. I have attached the resultant spreadsheet here for your reference.

Please give a try to the latest version on your side as well. In case the problem persists, please share the following details.

  • Architecture of Windows 10
  • Target .NET framework
  • Type of application
  • Locale of your machine
  • Aspose.Cells for .NET version you are currently using

C#

var book = new Workbook(dir + “abctod.xlsm”);
book.Save(dir + “output.xlsm”, SaveFormat.Xlsm);
Hello,

It looks like it has indeed been fixed in the latest version. I see that two evaluation tabs are created in excel now, but I can live with that issue for the moment. Thanks for sending over the latest and greatest.

Hi again,


Thank you for the confirmation. It is good to know that you are not experiencing the said problem while using the latest build of the API. Please note, you are getting the evaluation worksheets in resultant spreadsheet because you are probably not setting the license in your code. In case your license has expired or you haven’t yet acquired a license subscription, we suggest you to apply for a 30 day temporary license.