This project has moved and is read-only. For the latest updates, please go here.

Saving XLSM files

Oct 7, 2013 at 9:48 PM
I'm writing a program that edits data in an XLSM file. I can open the file and read from it just fine, but when I try to save it the file size is almost 100K smaller in size. When I try to open it Excel gives me this message: "The workbook cannot be opened or repaired by Microsoft Excel because it is corrupt."

I've studied the examples but didn't notice anything different from what I'm doing. Even the simple code below produces the same corrupted file. Am I doing something wrong? I've seen other questions where people were working with XLSM files just fine.
var package = new ExcelPackage(new FileInfo(@"C:\testing.xlsm"));