Encryption doesn't work at all

Oct 22, 2013 at 1:58 PM
Hello,

This is a very good lib, but I encountered a bug: it is impossible to encrypt the package!

My code:
FileStream stream = new FileStream("sample1.xlsx", FileMode.Create, FileAccess.ReadWrite);
ExcelPackage package = new ExcelPackage(stream);

try
{
   ExcelWorksheet worksheet = package.Workbook.Worksheets.Add("Sheet 1");

   worksheet.Cells["A1"].Value = 1234;
   worksheet.Cells["B1"].Value = 4321;

   worksheet.Cells["C1"].Formula = "A1+B1";

   worksheet.Cells.AutoFitColumns();

   package.Save("1234");
}
finally
{
   package.Dispose();
   stream.Close();
}
The resulted file is never encrypted!

I have tried with
package->Encryption->Password = "1234";
package->Encryption->IsEncrypted = true;
but it cannot works too.

The strangest part is that the files generated by the sample #10 are encrypted !

What is wrong with my code? It is a bug?

PS: I have Office 2007, .NET Framework 4 and Windows XP 32-bit.