Skip to content

Commit

Permalink
Version 4.5.0.3. Added some tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
JanKallman committed Mar 5, 2018
1 parent 02eaec6 commit 36139e8
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 10 deletions.
19 changes: 13 additions & 6 deletions EPPlus/EPPlus.MultiTarget.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

<PropertyGroup>
<TargetFrameworks>netstandard2.0;net35;net40</TargetFrameworks>
<AssemblyVersion>4.5.0.2</AssemblyVersion>
<FileVersion>4.5.0.2</FileVersion>
<Version>4.5.0.2-rc</Version>
<AssemblyVersion>4.5.0.3</AssemblyVersion>
<FileVersion>4.5.0.3</FileVersion>
<Version>4.5.0.3-rc</Version>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<PackageLicenseUrl>https://www.gnu.org/licenses/lgpl-3.0.en.html</PackageLicenseUrl>
<PackageProjectUrl>https://github.com/JanKallman/EPPlus</PackageProjectUrl>
Expand All @@ -17,15 +17,22 @@
<RepositoryUrl></RepositoryUrl>
<PackageTags>Excel ooxml</PackageTags>
<Copyright>Jan Källman 2018</Copyright>
<PackageReleaseNotes>EPPlus 4.5 rc
This version will be the last before the final 4.5, if no major bugs are found.
Please help us test it!
<PackageReleaseNotes>EPPlus 4.5.0.3 rc

This version fixes a bug in the compound document classes effecting VBA and Encryption.

NOTE: Breaking change in .Net Core. The indexer of the worksheets collection will be zero based. See remarks under 4.5.0.1 Beta 1 below.

Visit https://github.com/JanKallman/EPPlus for the latest information

EPPlus-Create advanced Excel spreadsheet.

4.5.0.3
* Fix for compund documents (VBA and Encryption).
* Fix for Excel 2010 sha1 hashed agile encryption.
* Upgraded System.Drawing.Common to 4.5.0-preview1-26216-02
* Also se https://github.com/JanKallman/EPPlus/commits/master

4.5.0.2 rc
* Merged in a few pull requests and fixed some issues. See https://github.com/JanKallman/EPPlus/commits/master

Expand Down
4 changes: 2 additions & 2 deletions EPPlus/Encryption/EncryptionHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,7 @@ private MemoryStream DecryptAgile(EncryptionInfoAgile encryptionInfo, string pas
return null;
}
#if Core
private HashAlgorithm GetHashProvider(EncryptionInfoAgile.EncryptionKeyEncryptor encr)
private HashAlgorithm GetHashProvider(EncryptionInfoAgile.EncryptionKeyData encr)
{
switch (encr.HashAlgorithm)
{
Expand Down Expand Up @@ -821,7 +821,7 @@ private byte[] DecryptAgileFromKey(EncryptionInfoAgile.EncryptionKeyData encr, b
}

#if (Core)
private SymmetricAlgorithm GetEncryptionAlgorithm(EncryptionInfoAgile.EncryptionKeyEncryptor encr)
private SymmetricAlgorithm GetEncryptionAlgorithm(EncryptionInfoAgile.EncryptionKeyData encr)
{
switch (encr.CipherAlgorithm)
{
Expand Down
2 changes: 1 addition & 1 deletion EPPlus/ExcelWorksheets.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1076,7 +1076,7 @@ private ExcelWorksheet GetByName(string Name)
}
return (xlWorksheet);
}
#region MoveBefore and MoveAfter Methods
#region MoveBefore and MoveAfter Methods
/// <summary>
/// Moves the source worksheet to the position before the target worksheet
/// </summary>
Expand Down
43 changes: 43 additions & 0 deletions EPPlusTest/CompoundDoc.cs
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,49 @@ private void printitems(CompoundDocumentItem item)
printitems(c);
}
}
[TestMethod]
public void WriteReadCompundDoc()
{
for(int i=1;i<50;i++)
{
var b=CreateFile(i);
ReadFile(b,i);
GC.Collect();
}
for (int i = 5; i < 20; i++)
{
var b = CreateFile(i*50);
ReadFile(b, i*50);
GC.Collect();
}
}

private void ReadFile(byte[] b, int noSheets)
{
var ms = new MemoryStream(b);
using (var p = new ExcelPackage(ms))
{
Assert.AreEqual(p.Workbook.VbaProject.Modules.Count,noSheets+2);
Assert.AreEqual(noSheets, p.Workbook.Worksheets.Count);
}
}

public byte[] CreateFile(int noSheets)
{
using (var package = new ExcelPackage())
{
var sheets = Enumerable.Range(1, noSheets) //460
.Select(x => $"Sheet{x}");
foreach (var sheet in sheets)
package.Workbook.Worksheets.Add(sheet);

package.Workbook.CreateVBAProject();
package.Workbook.VbaProject.Modules.AddModule("Module1").Code
= "\r\nPublic Sub SayHello()\r\nMsgBox(\"Hello\")\r\nEnd Sub\r\n";

return package.GetAsByteArray();
}
}

[TestMethod, Ignore ]
public void ReadEncLong()
Expand Down
2 changes: 1 addition & 1 deletion EPPlusTest/Issues.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1938,7 +1938,7 @@ public void Issue94()
package.SaveAs(new FileInfo(@"c:\temp\bug\iss94\MergedCellsTemplateSaved.xlsx"));
}
}
[TestMethod]
[TestMethod, Ignore]
public void Issue107()
{
using (ExcelPackage epIN = new ExcelPackage(new FileInfo(@"C:\temp\bug\issue107\in.xlsx")))
Expand Down

0 comments on commit 36139e8

Please sign in to comment.