Problem saving with multi-sheet template

Jul 3, 2013 at 8:40 AM
Edited Jul 3, 2013 at 9:17 AM
Scenario: opening a template xlsx with multiple sheets on it, writing some values to first sheet, then calling SaveAs ( ... ). This worked just fine until I added those extra worksheets on the template.

Any ideas, apart from just not having multiple sheets on my template?

EDIT: Modifying the template over and over again, I managed to track whatever crashes saving the file into some styles/comments used in one of the extra worksheets. Pretty standard Excel stuff, but I guess there was something among them that doesn't sit well with OpenOfficeXml. While my problem has been evaded, I'll leave this thread here, just in case anyone gets same error or just wants to dig to the roots of the issue.
System.InvalidOperationException was unhandled
  Message=Error saving file C:\
    at OfficeOpenXml.ExcelPackage.Save()
    at OfficeOpenXml.ExcelPackage.SaveAs(FileInfo file)

InnerException: System.InvalidOperationException
   Message=Cannot add part for the specified URI because it is already in the package.
        at System.IO.Packaging.Package.CreatePart(Uri partUri, String contentType, CompressionOption compressionOption)
        at OfficeOpenXml.ExcelWorksheet.SaveComments()
        at OfficeOpenXml.ExcelWorksheet.Save()
        at OfficeOpenXml.ExcelWorkbook.Save()
        at OfficeOpenXml.ExcelPackage.Save()