Skip to content

Commit

Permalink
Version 4.5.3.2
Browse files Browse the repository at this point in the history
Added target build for netcoreapp2.1
Fixed Issues JanKallman#345, JanKallman#471, JanKallman#460. Fixed problem with defined names that contained a backslash
  • Loading branch information
Jan Källman committed Jun 16, 2019
1 parent b38d37f commit 4dacf27
Show file tree
Hide file tree
Showing 7 changed files with 83 additions and 16 deletions.
2 changes: 1 addition & 1 deletion EPPlus/CellStore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1106,7 +1106,7 @@ private int DeletePage(int fromRow, int rows, ColumnIndex column, int pagePos, b
var delSize=page.MaxIndex - page.MinIndex+1;
rows -= delSize;
var prevOffset = page.Offset;
Array.Copy(column._pages, pagePos + 1, column._pages, pagePos, column.PageCount - pagePos);
Array.Copy(column._pages, pagePos + 1, column._pages, pagePos, column.PageCount - pagePos - 1);
column.PageCount--;
if (column.PageCount == 0)
{
Expand Down
29 changes: 23 additions & 6 deletions EPPlus/EPPlus.MultiTarget.csproj
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netstandard2.0;net35;net40</TargetFrameworks>
<AssemblyVersion>4.5.3.1</AssemblyVersion>
<FileVersion>4.5.3.1</FileVersion>
<Version>4.5.3.1</Version>
<TargetFrameworks>netcoreapp2.1;netstandard2.0;net35;net40</TargetFrameworks>
<AssemblyVersion>4.5.3.2</AssemblyVersion>
<FileVersion>4.5.3.2</FileVersion>
<Version>4.5.3.2</Version>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<PackageLicenseUrl>https://licenses.nuget.org/LGPL-3.0-or-later</PackageLicenseUrl>
<PackageProjectUrl>https://github.com/JanKallman/EPPlus</PackageProjectUrl>
Expand All @@ -17,7 +17,7 @@
<RepositoryUrl></RepositoryUrl>
<PackageTags>Excel ooxml</PackageTags>
<Copyright>Jan Källman 2018</Copyright>
<PackageReleaseNotes>EPPlus 4.5.3.1
<PackageReleaseNotes>EPPlus 4.5.3.2

New features in version 4.5:
* .NET Core support
Expand All @@ -43,8 +43,13 @@ apt-get:
apt-get install libgdiplus

EPPlus-A .NET Spreadsheet API

Changes
4.5.3.2
* Added a target build for .NET Core 2.1 (netcoreapp2.1) with System.Drawing.Common 4.6.0-preview6.19303.8
* Fixed Text property with short date format
* Fixed problem with defined names containing backslash
* More bugfixes, see https://github.com/JanKallman/EPPlus/commits/master

4.5.3.1
* Fixed Lookup function ignoring result vector.
* Fixed address validation.
Expand Down Expand Up @@ -226,6 +231,10 @@ Release Candidate changes
<DefineConstants>Core;STANDARD20</DefineConstants>
</PropertyGroup>

<PropertyGroup Condition=" '$(TargetFramework)' == 'netcoreapp2.1'">
<DefineConstants>Core</DefineConstants>
</PropertyGroup>

<PropertyGroup Condition=" '$(TargetFramework)' == 'net35'">
<DefineConstants>NET35;NETFULL</DefineConstants>
</PropertyGroup>
Expand Down Expand Up @@ -285,6 +294,14 @@ Release Candidate changes
<PackageReference Include="System.Xml.XmlDocument" Version="4.3.0" />
<PackageReference Include="System.Xml.XPath.XmlDocument" Version="4.3.0" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp2.1'">
<PackageReference Include="System.Drawing.Common" Version="4.6.0-preview6.19303.8" />
<PackageReference Include="System.Security.Cryptography.Pkcs" Version="4.5.2" />
<PackageReference Include="System.Security.Cryptography.X509Certificates" Version="4.3.2" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="2.2.0" />
<PackageReference Include="System.Text.Encoding.CodePages" Version="4.5.1" />
</ItemGroup>

<ItemGroup>
<None Update="readme.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
Expand Down
2 changes: 1 addition & 1 deletion EPPlus/ExcelNamedRangeCollection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public ExcelNamedRange Add(string Name, ExcelRangeBase Range)
ExcelNamedRange item;
if(!ExcelAddressUtil.IsValidName(Name))
{
throw (new ArgumentException("Name contains invalid characters"));
throw (new ArgumentException($"Name {Name} contains invalid characters")); //Issue 458
}
if (Range.IsName)
{
Expand Down
31 changes: 26 additions & 5 deletions EPPlus/ExcelRangeBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2668,23 +2668,44 @@ public void Copy(ExcelRangeBase Destination, ExcelRangeCopyOptionFlags? excelRan
Destination._worksheet.MergedCells.Add(m, true);
}
}

//Check that the range is not larger than the dimensions of the worksheet.
//If so set the copied range to the worksheet dimensions to avoid copying empty cells.
ExcelAddressBase range;

if (Worksheet.Dimension == null)
{
range = this;
}
else
{
var collideStatus = Collide(Worksheet.Dimension);
if (collideStatus != eAddressCollition.Equal || collideStatus != eAddressCollition.Inside)
{
range = Worksheet.Dimension;
}
else
{
range = this;
}
}

if (_fromCol == 1 && _toCol == ExcelPackage.MaxColumns)
{
for (int r = 0; r < this.Rows; r++)
for (int r = 0; r < range.Rows; r++)
{
var destinationRow = Destination.Worksheet.Row(Destination.Start.Row + r);
destinationRow.OutlineLevel = this.Worksheet.Row(_fromRow + r).OutlineLevel;
destinationRow.OutlineLevel = Worksheet.Row(range._fromRow + r).OutlineLevel;
}
}
if (_fromRow == 1 && _toRow == ExcelPackage.MaxRows)
{
for (int c = 0; c < this.Columns; c++)
for (int c = 0; c < range.Columns; c++)
{
var destinationCol = Destination.Worksheet.Column(Destination.Start.Column + c);
destinationCol.OutlineLevel = this.Worksheet.Column(_fromCol + c).OutlineLevel;
destinationCol.OutlineLevel = Worksheet.Column(range._fromCol + c).OutlineLevel;
}
}

}

/// <summary>
Expand Down
2 changes: 1 addition & 1 deletion EPPlus/FormulaParsing/ExcelUtilities/ExcelAddressUtil.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public static bool IsValidAddress(string token)
}
return OfficeOpenXml.ExcelAddress.IsValidAddress(token);
}
readonly static char[] NameInvalidChars = new char[] { '!', '@', '#', '$', '£', '%', '&', '/', '(', ')', '[', ']', '{', '}', '<', '>', '=', '+', '?', '\\', '*', '-', '~', '^', ':', ';', '|', ',', ' ' };
readonly static char[] NameInvalidChars = new char[] { '!', '@', '#', '$', '£', '%', '&', '/', '(', ')', '[', ']', '{', '}', '<', '>', '=', '+', '*', '-', '~', '^', ':', ';', '|', ',', ' ' };
public static bool IsValidName(string name)
{
if (string.IsNullOrEmpty(name))
Expand Down
12 changes: 11 additions & 1 deletion EPPlus/readme.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
EPPlus 4.5.3
EPPlus 4.5.3.2

New features in version 4.5:
* .NET Core support
Expand Down Expand Up @@ -26,6 +26,16 @@ apt-get install libgdiplus
EPPlus-A .NET Spreadsheet API

Changes
4.5.3.2
* Added a target build for .NET Core 2.1 (netcoreapp2.1) with System.Drawing.Common 4.6.0-preview6.19303.8
* Fixed Text property with short date format
* Fixed problem with defined names containing backslash
* More bugfixes, see https://github.com/JanKallman/EPPlus/commits/master

4.5.3.1
* Fixed Lookup function ignoring result vector.
* Fixed address validation.

4.5.3
* Upgraded System.Drawing.Common for .NET Core to 4.5.1
* Enabled worksheetcharts to use a pivottable as source by adding a pivotTableSource parameter to the AddChart method of the Worksheets collection
Expand Down
21 changes: 20 additions & 1 deletion EPPlusTest/Issues.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2407,5 +2407,24 @@ public void Issue445()
ws.Cells[1, 1].Value = new string('a', 50000);
ws.Cells[1, 1].AutoFitColumns();
}
[TestMethod]
public void Issue460()
{
var p = OpenTemplatePackage("Issue460.xlsx");
var ws = p.Workbook.Worksheets[0];
var newWs=p.Workbook.Worksheets.Add("NewSheet");
ws.Cells.Copy(newWs.Cells);
SaveWorksheet("Issue460_saved.xlsx");
}
[TestMethod]
public void Issue476()
{
var p = OpenTemplatePackage("Issue345.xlsx");
var ws = p.Workbook.Worksheets[0];
int[] sortColumns = new int[1];
sortColumns[0] = 0;
ws.Cells["A2:A64515"].Sort(sortColumns);
SaveWorksheet("Issue345_saved.xlsx");
}
}
}
}

0 comments on commit 4dacf27

Please sign in to comment.