Skip to content

Commit

Permalink
Merge pull request #1 from TheXDS/master
Browse files Browse the repository at this point in the history
Merge commits from TheXDS/EPPlus
  • Loading branch information
xorets committed Jul 31, 2023
2 parents 55c5ba6 + a277715 commit b09ee8b
Show file tree
Hide file tree
Showing 17 changed files with 979 additions and 185 deletions.
19 changes: 8 additions & 11 deletions EPPlus/CellStore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,8 @@
*******************************************************************************/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;
using OfficeOpenXml;
using OfficeOpenXml.FormulaParsing.Excel.Functions.RefAndLookup;

internal class IndexBase : IComparable<IndexBase>
{
Expand All @@ -53,7 +50,7 @@ internal int IndexPointer
get;
set;
}
internal short Index;
internal int Index;
public int CompareTo(IndexItem other)
{
return Index - other.Index;
Expand Down Expand Up @@ -653,7 +650,7 @@ internal void SetValue(int Row, int Column, T Value)
pageItem = _columnIndex[col]._pages[pos];
}

short ix = (short)(Row - ((pageItem.Index << pageBits) + pageItem.Offset));
int ix = Row - ((pageItem.Index << pageBits) + pageItem.Offset);
_searchItem.Index = ix;
var cellPos = Array.BinarySearch(pageItem.Rows, 0, pageItem.RowCount, _searchItem);
if (cellPos < 0)
Expand All @@ -671,7 +668,7 @@ internal void SetValue(int Row, int Column, T Value)
col = ~col;
AddColumn(col, Column);
AddPage(_columnIndex[col], 0, page);
short ix = (short)(Row - (page << pageBits));
int ix = Row - (page << pageBits);
AddCell(_columnIndex[col], 0, 0, ix, Value);
}
}
Expand Down Expand Up @@ -742,7 +739,7 @@ internal void SetRangeValueSpecial(int fromRow, int fromColumn, int toRow, int t
pageItem = _columnIndex[col]._pages[pos];
}

short ix = (short)(rowIx - ((pageItem.Index << pageBits) + pageItem.Offset));
int ix = rowIx - ((pageItem.Index << pageBits) + pageItem.Offset);
_searchItem.Index = ix;
var cellPos = Array.BinarySearch(pageItem.Rows, 0, pageItem.RowCount, _searchItem);
if (cellPos < 0)
Expand All @@ -761,7 +758,7 @@ internal void SetRangeValueSpecial(int fromRow, int fromColumn, int toRow, int t
col = ~col;
AddColumn(col, colIx);
AddPage(_columnIndex[col], 0, page);
short ix = (short)(rowIx - (page << pageBits));
int ix = rowIx - (page << pageBits);
AddCell(_columnIndex[col], 0, 0, ix, default(T));
Updater(_values, _columnIndex[col]._pages[0].Rows[0].IndexPointer, rowIx, colIx, Value);
}
Expand Down Expand Up @@ -812,7 +809,7 @@ internal void SetValueSpecial(int Row, int Column, SetValueDelegate Updater, obj
pageItem = _columnIndex[col]._pages[pos];
}

short ix = (short)(Row - ((pageItem.Index << pageBits) + pageItem.Offset));
int ix = Row - ((pageItem.Index << pageBits) + pageItem.Offset);
_searchItem.Index = ix;
var cellPos = Array.BinarySearch(pageItem.Rows, 0, pageItem.RowCount, _searchItem);
if (cellPos < 0)
Expand All @@ -831,7 +828,7 @@ internal void SetValueSpecial(int Row, int Column, SetValueDelegate Updater, obj
col = ~col;
AddColumn(col, Column);
AddPage(_columnIndex[col], 0, page);
short ix = (short)(Row - (page << pageBits));
int ix = Row - (page << pageBits);
AddCell(_columnIndex[col], 0, 0, ix, default(T));
Updater(_values, _columnIndex[col]._pages[0].Rows[0].IndexPointer, Value);
}
Expand Down Expand Up @@ -1421,7 +1418,7 @@ internal static int GetSize(int size)
}
return newSize;
}
private void AddCell(ColumnIndex columnIndex, int pagePos, int pos, short ix, T value)
private void AddCell(ColumnIndex columnIndex, int pagePos, int pos, int ix, T value)
{
PageIndex pageItem = columnIndex._pages[pagePos];
if (pageItem.RowCount == pageItem.Rows.Length)
Expand Down
12 changes: 12 additions & 0 deletions EPPlus/Drawing/ExcelPicture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,10 @@
using System.Drawing;
using System.Drawing.Imaging;
using System.Diagnostics;
using System.Windows;
using OfficeOpenXml.Utils;
using OfficeOpenXml.Compatibility;
using Size = System.Drawing.Size;

namespace OfficeOpenXml.Drawing
{
Expand Down Expand Up @@ -353,6 +355,16 @@ internal string ContentType
get;
set;
}

//public Vector GetOffset()
//{
// return new Vector(_left, _top);
//}
public Size GetSize()
{
return new Size(_width, _height);
}

/// <summary>
/// Set the size of the image in percent from the orginal size
/// Note that resizing columns / rows after using this function will effect the size of the picture
Expand Down
116 changes: 76 additions & 40 deletions EPPlus/EPPlus.MultiTarget.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netstandard2.1;netstandard2.0;net35;net40</TargetFrameworks>
<TargetFrameworks>netcoreapp3.1;netcoreapp3.0;netstandard2.1;netcoreapp2.2;netcoreapp2.1;netstandard2.0;net40</TargetFrameworks>
<AssemblyVersion>4.5.3.3</AssemblyVersion>
<FileVersion>4.5.3.3</FileVersion>
<Version>4.5.3.3</Version>
Expand Down Expand Up @@ -207,30 +207,30 @@

Beta 2 Changes
* Fixed bug when using RepeatColumns &amp; RepeatRows at the same time.
* VBA project will be left untouched if it’s not accessed.
* Fixed problem with strings on save.
* Added locks to the cell store for access by multiple threads.
* Implemented Indirect function
* Used DisplayNameAttribute to generate column headers from LoadFromCollection
* Rewrote ExcelRangeBase.Copy function.
* Added caching to Save ZipStream for Cells and shared strings to speed up the Save method.
* Added Missing InsertColumn and DeleteColumn
* Added pull request to support Date1904
* Added pull request ExcelWorksheet. LoadFromDataReader

Release Candidate changes
* Fixed some problems with Range.Copy Function
* InsertColumn and Delete column didn't work in some cases
* Chart.DisplayBlankAs had the wrong default type in Excel 2010+
* Datavalidation list overflow caused corruption of the package
* Fixed a few Calculation when referring ranges (for example If function)
* Added ChartAxis.DisplayUnit
* Fixed a bug related to shared formulas
* Named styles failed in some cases.
* Style.Indent got an invalid value in some cases.
* Fixed a problem with AutofitColumns method.
* Performance fix.
* A whole lot of other small fixes.
* VBA project will be left untouched if it’s not accessed.
* Fixed problem with strings on save.
* Added locks to the cell store for access by multiple threads.
* Implemented Indirect function
* Used DisplayNameAttribute to generate column headers from LoadFromCollection
* Rewrote ExcelRangeBase.Copy function.
* Added caching to Save ZipStream for Cells and shared strings to speed up the Save method.
* Added Missing InsertColumn and DeleteColumn
* Added pull request to support Date1904
* Added pull request ExcelWorksheet. LoadFromDataReader

Release Candidate changes
* Fixed some problems with Range.Copy Function
* InsertColumn and Delete column didn't work in some cases
* Chart.DisplayBlankAs had the wrong default type in Excel 2010+
* Datavalidation list overflow caused corruption of the package
* Fixed a few Calculation when referring ranges (for example If function)
* Added ChartAxis.DisplayUnit
* Fixed a bug related to shared formulas
* Named styles failed in some cases.
* Style.Indent got an invalid value in some cases.
* Fixed a problem with AutofitColumns method.
* Performance fix.
* A whole lot of other small fixes.
</PackageReleaseNotes>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>OpenOfficeXml.snk</AssemblyOriginatorKeyFile>
Expand All @@ -246,6 +246,23 @@ Release Candidate changes
<DefineConstants>Core</DefineConstants>
</PropertyGroup>

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

<PropertyGroup Condition=" '$(TargetFramework)' == 'netcoreapp3.0'">
<DefineConstants>Core</DefineConstants>
</PropertyGroup>

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

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


<PropertyGroup Condition=" '$(TargetFramework)' == 'net35'">
<DefineConstants>NET35;NETFULL</DefineConstants>
</PropertyGroup>
Expand Down Expand Up @@ -291,12 +308,10 @@ Release Candidate changes
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="3.1.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="3.1.1" />
<PackageReference Include="System.ComponentModel.TypeConverter" Version="4.3.0" />
<PackageReference Include="System.Data.Common" Version="4.3.0" />
<PackageReference Include="System.Drawing.Common">
<Version>4.7.0</Version>
</PackageReference>
<PackageReference Include="System.Drawing.Common" Version="4.7.0" />
<PackageReference Include="System.Reflection" Version="4.3.0" />
<PackageReference Include="System.Security.Claims" Version="4.3.0" />
<PackageReference Include="System.Security.Cryptography.Pkcs" Version="4.7.0" />
Expand All @@ -305,20 +320,41 @@ 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.7.0" />
<PackageReference Include="System.Security.Cryptography.Pkcs" Version="4.7.0" />
<PackageReference Include="System.Security.Cryptography.X509Certificates" Version="4.3.2" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="3.1.1" />
<PackageReference Include="System.Text.Encoding.CodePages" Version="4.7.0" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp2.2'">
<PackageReference Include="System.Drawing.Common" Version="4.7.0" />
<PackageReference Include="System.Security.Cryptography.Pkcs" Version="4.7.0" />
<PackageReference Include="System.Security.Cryptography.X509Certificates" Version="4.3.2" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="3.1.1" />
<PackageReference Include="System.Text.Encoding.CodePages" Version="4.7.0" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp3.0'">
<PackageReference Include="System.Drawing.Common" Version="4.7.0" />
<PackageReference Include="System.Security.Cryptography.Pkcs" Version="4.7.0" />
<PackageReference Include="System.Security.Cryptography.X509Certificates" Version="4.3.2" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="3.1.1" />
<PackageReference Include="System.Text.Encoding.CodePages" Version="4.7.0" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp3.1'">
<PackageReference Include="System.Drawing.Common" Version="4.7.0" />
<PackageReference Include="System.Security.Cryptography.Pkcs" Version="4.7.0" />
<PackageReference Include="System.Security.Cryptography.X509Certificates" Version="4.3.2" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="3.1.1" />
<PackageReference Include="System.Text.Encoding.CodePages" Version="4.7.0" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.1'">
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="3.1.0" />
<PackageReference Include="System.ComponentModel.TypeConverter" Version="4.3.0" />
<PackageReference Include="System.Data.Common" Version="4.3.0" />
<PackageReference Include="System.Drawing.Common">
<Version>4.7.0</Version>
</PackageReference>
<PackageReference Include="System.Reflection" Version="4.3.0" />
<PackageReference Include="System.Security.Claims" Version="4.3.0" />
<PackageReference Include="System.Drawing.Common" Version="4.7.0" />
<PackageReference Include="System.Security.Cryptography.Pkcs" Version="4.7.0" />
<PackageReference Include="System.Security.Cryptography.X509Certificates" Version="4.3.2" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="3.1.1" />
<PackageReference Include="System.Text.Encoding.CodePages" Version="4.7.0" />
<PackageReference Include="System.Xml.XmlDocument" Version="4.3.0" />
<PackageReference Include="System.Xml.XPath.XmlDocument" Version="4.3.0" />
</ItemGroup>
<ItemGroup>
<None Update="readme.txt">
Expand All @@ -329,4 +365,4 @@ Release Candidate changes
<PackagePath></PackagePath>
</None>
</ItemGroup>
</Project>
</Project>
1 change: 1 addition & 0 deletions EPPlus/EPPlus.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@
<Compile Include="ConditionalFormatting\Rules\ExcelConditionalFormattingUniqueValues.cs" />
<Compile Include="ConditionalFormatting\Rules\ExcelConditionalFormattingYesterday.cs" />
<Compile Include="Drawing\Chart\ExcelChartDataTable.cs" />
<Compile Include="ExcelIgnoredError.cs" />
<Compile Include="FontSize.cs" />
<Compile Include="DataValidation\Contracts\IExcelDataValidation.cs" />
<Compile Include="DataValidation\Contracts\IExcelDataValidationAny.cs" />
Expand Down
2 changes: 1 addition & 1 deletion EPPlus/Encryption/EncryptionHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ private HMAC GetHmacProvider(EncryptionInfoAgile.EncryptionKeyData ei, byte[] sa
{
switch (ei.HashAlgorithm)
{
#if (!Core)
#if !Core
case eHashAlogorithm.RIPEMD160:
return new HMACRIPEMD160(salt);
#endif
Expand Down
2 changes: 1 addition & 1 deletion EPPlus/ExcelHeaderFooter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ public ExcelVmlDrawingPicture InsertPicture(FileInfo PictureFile, PictureAlignme

string contentType = ExcelPicture.GetContentType(PictureFile.Extension);
var uriPic = XmlHelper.GetNewUri(_ws._package.Package, "/xl/media/" + PictureFile.Name.Substring(0, PictureFile.Name.Length-PictureFile.Extension.Length) + "{0}" + PictureFile.Extension);
#if (Core)
#if Core
var imgBytes=ImageCompat.GetImageAsByteArray(Picture);
#else
var ic = new ImageConverter();
Expand Down
67 changes: 67 additions & 0 deletions EPPlus/ExcelIgnoredError.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
/*******************************************************************************
* Implemented following briddums advise ( https://stackoverflow.com/users/260473/briddums ),
* as himself explained in https://stackoverflow.com/questions/11858109/using-epplus-excel-how-to-ignore-excel-error-checking-or-remove-green-tag-on-t/14483234#14483234
* The best way to address this issue is adding a whorksheet property that allows to ignore the warnings in a specified range.
*******************************************************************************/

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;

namespace OfficeOpenXml
{
public class ExcelIgnoredError : XmlHelper
{
private ExcelWorksheet _worksheet;

/// <summary>
/// Constructor
/// </summary>
internal ExcelIgnoredError(XmlNamespaceManager ns, XmlNode node, ExcelWorksheet xlWorkSheet) :
base(ns, node)
{
_worksheet = xlWorkSheet;
}


public bool NumberStoredAsText
{
get
{
return GetXmlNodeBool("@numberStoredAsText");
}
set
{
SetXmlNodeBool("@numberStoredAsText", value);
}
}


public bool TwoDigitTextYear
{
get
{
return GetXmlNodeBool("@twoDigitTextYear");
}
set
{
SetXmlNodeBool("@twoDigitTextYear", value);
}
}


public string Range
{
get
{
return GetXmlNodeString("@sqref");
}
set
{
SetXmlNodeString("@sqref", value);
}
}
}
}
Loading

0 comments on commit b09ee8b

Please sign in to comment.