Save with more than one worksheets

May 26, 2010 at 12:36 PM

In these days i've started use ExcelPackage, it works fine with my aims

but i get a problem with multisheets file:

follow my source code
 

             if (File.Exists(GeneralFilename)) File.Delete(GeneralFilename);

            FileInfo newFile = new FileInfo(GeneralFilename);
            FileInfo templateFile = new FileInfo(TemplateFilename);

            using (ExcelPackage xlPackage = new ExcelPackage(newFile, templateFile))
            //using (ExcelPackage xlPackage = new ExcelPackage(newFile))
            {

              ...

             }

             xlspackage.save();

 

save method give me an error

  StackTrace "  
in OfficeOpenXml.ExcelWorksheet.Save()\r\n  
in OfficeOpenXml.ExcelWorkbook.Save()\r\n  
in OfficeOpenXml.ExcelPackage.Save()\r\n  
in xxxxxx.WindowsApp.wsForm.CreateExcelForTemplate()
in D:\\xxxx.Middleware.root\\xxxx.Middleware\\xxxx.WindowsApp\\wsForm.cs:riga 672" string

error occurs when in the template file i've got more than 1 sheet (it works with just 1 sheet!?)

anybody have suggests

thanks