Skip to content

Commit 55ac136

Browse files
JanKallmanAdrianEPPlusOssianEPPlusswmalswmal
authored
Develop7 2 (#1487)
* Started work on the GetPivotData function * More work on Pivot table calculation * Added support for basic calculation of pivot table formulas * Added support for all pivot functions when calculating a pivot table * Added basic support for pivot table - Show Data As * WIP:More work on pivot calculation - Show value as * WIP:More work on pivot calculation - Show value as * WIP: More work on Show as PercentOf * WIP: Pivot table show value as * WIP:Added dictionary support for fields not in the row/col hierki * WIP:Support for % of Row/Column Total * WIP:Tests * WIP:PercentOf * WIP:ShowAs Running Total * Added new PivotCacheStore * WIP:Pivot Calculation Store * WIP: Added tests for evaluation of pivot table caption filters * WIP:Started on value filters * WIP:Added new PivotCalculationStore * WIP:Pivot Tabel Calculation * WIP:GetPivotData * WIP:Pivot Calculation Percent of * WIP:RunningTotal * WIP:RunningTotal * WIP: ShowAs Running Total * WIP: ShowAs Rank Descending * WIP:Added ShowAsIndex * WIP:ShowAs Index * WIP:Calculation of Date and Numeric Grouping * WIP:Fixed grouping issues for failing tests * WIP: Fixed some tests * WIP:Value Filter in calc * WIP:Added support for all value filter except top-bottom filters * WIP:Added support for Top/Bottom filter * WIP:Added support for Sum and Percent Top/Bottom filters * WIP:Calculate Pivot Table Grouping * WIP:Added support for calculation of date and numeric groupings * WIP:pt.ColumnFields.Add(pt.Fields[Continent]); * WIP:Fixed some failing tests * Fixed copy issue of pivot tables. * WIP:Added tests for date grouping calculation * WIP:More work on calculating numeric groupings in pivot tables * WIP:Fixed some issues with calculaing numeric and date grouping * WIP:Fixed Tests * WIP:Added support sort. * WIP:Started work on pivot table field formulas calculation * WIP:Calculated pivot fields * WIP:Calculation of pivot fields * WIP:Fixed reading of pivot records. Fixed a few bugs * WIP:Fixed cache comparer to match on strings. Fixed issue with calculating grouped columns. Started work on slicer filtering * WIP:Pivot table slicer filters in calculation * WIP:Work on Pivot Table Calculation * WIP:Fixed compile error. Removed tests * WIP:Fixed failing tests * Fixed some issues and tests in the pivot calculation. * Set ExcelPivotTable.GetPivotData to public. The GetPivotData method now calculates a pivottable if it has not been calculated. Fixed some test * Fixed Text replace issue * Added more tests for multiple data fields of the same pivot field * Added CalculatedData property * Added tests * Fixes issue #1421 * Added new Property CalculatedItems. Removed redundant property ExcelPivotTableField.CacheField * Added calculation of multiple subtotals * Added support for muliple subtotals on row/column fields * Added new interface for class ExcelPivotTable.CalculatedData * Added new aggregation to speed up performance. * Fixed an issue with subtotal items. Added new tests for refreshing the cache * Fixed some issues with aggregated keys on row/columns. Added tests. * Feature/textsplit func (#1426) * Added excel function TEXTSPLIT * TextBefore excel function * TetxtBefore workbook test * TEXTAFTER Excel function * MMULT excel function added * TEXTBEFORE Now accepts ranges as arg * TEXTAFTER function takes range as arg * MINVERSER excel function started * Added mdeterm, munit & more * Fixed issues with new excel functions * split some code into other functions * fixed null ref in mmult * Feature/transpose (#1420) * Added test case for transposing data table * Read transposed data from worksheet to DataTable * Added exporting from tranposed worksheet to text and collection * export json from transposed. * Export text async from transposed. * Transpse Range copy * Load from dictionary to transposed * Load from Array Transposed * Load collection to transposed progess * Load from collection to transposed * Load from array transposed * Load data reader to transposed * Fixed test issue with transpose * changed name of some variables * fixed variable names * Feature/html icon sets (#1425) * Adding start of iconset exports * Encoding wrong * Fixed several bugs added functional encoding * added viewbox * Added functional css for one icon * Added easy set handling and start of shouldapply icon * Added several icons * Ensured scalability, added several symbols * Added all remaining icons. Made 4 and 5 iconsets work. * Attempt at hex handling * Resolved multiple bugs. Added better set reference * Fixed percentile for iconsets. PercentRank.Inc appears to be the function * Fixes issue #1421 (#1422) * Cleanup and bugfix * Fix exception message in automapping in ToCollection (#1423) * Added fixed issues * Fixed test added fixed issues * Cleanup * Fixed comment with info --------- Co-authored-by: Jan Källman <[email protected]> * Fixed some failing tests * Minor refactoring * Fixed async difference (#1438) * Removed commented out code. Updated headers to version 7.2 * Made testbase unicode * adding tests unfinished * Feature/html databars (#1439) * Adding start of iconset exports * Encoding wrong * Fixed several bugs added functional encoding * added viewbox * Added functional css for one icon * Added easy set handling and start of shouldapply icon * Added several icons * Ensured scalability, added several symbols * Added all remaining icons. Made 4 and 5 iconsets work. * Attempt at hex handling * Resolved multiple bugs. Added better set reference * Fixed percentile for iconsets. PercentRank.Inc appears to be the function * Fixes issue #1421 (#1422) * Cleanup and bugfix * Fix exception message in automapping in ToCollection (#1423) * Added fixed issues * Fixed test added fixed issues * Added databar functionality. Likely bugged. * Added databar bugfixes * Ensured axis position and variable clarity * Added support for formula, percentile and num * added percent * Corrected test-cases * Fixed height issue * Merge fix * Prevented potential name conflict * Caching iconsets/better names * Adjusted databar names * Cleanup and test --------- Co-authored-by: Jan Källman <[email protected]> * Feature/fixed width (#1419) * LoadFromCollection/new logic for member sort order (#1296) * wip * wip2 * wip * Wip 2 * wip * First version of LoadFromCollection after refactoring * wip 3 * WIP 3 * Adjusted CreatePropertyGetter so it supports inheriting classes to * Removed uncommented code --------- Co-authored-by: swmal <{ID}+username}@users.noreply.github.com> * Feature/cf html exporter (#1349) * New css and html connection based on CF. Poor performance * Added Quadtree fetched CF-dictionary * First solution functional on single cells * Added support for more types and start of class diagraAdded support for more types and start of class diagramm * Temp draft save * Added endsWith * Added several styles to dxfCss * Fixed underline and strike through but can't stop strikethrough double * Staticified some caches * Added wrapper * Broke out stylecache from css adjusted names of css styles to stack in right specificity order and fixed bug in get collection from range * Completely removed stylecache from writers * Initial creation of new writers * Ensured translator and new writer can handle fills * Added TranslatorBase fill font and translatorContext logic * Added border and textFormat translators * Simplified rangeTranslator and added sharedClasses * Added stylecache * Added picture translator * Properties and new if-case * Added stylechecker class * Translators * Start of adding dxf * Generic style draft * First draft of styleContracts * New draft applying interfaces instead * Adding of color * color fixes * Color added * Added initial border * Renamed interface style and re-introduced merged cells * Attempt at delegates * New handling of intersect detection * Simplification of conditionalFormatting * Started adding tables. Alignment missing on range * Added start of table writer replacement * Added table support * Fixed bugs for table in range. In process of fixing tableExporter * minor fix * Added async writing to new methods * Async support and table/range unification * Finialized unification * Fixes fill when no fill was present * Fixed multiple bugs to ensure all tests pass * Cleanup and deletion of old files * Html alternative draftHtml * Half-implemented header row * Added htmlElement to headerRow * Function breakout and start of renderTablerows * Fixed minor formatting htmlsync bugs * Simplified writer fixed html formatting of images in cells * Start of joint functions for html tables and ranges * Moved range over to standard functions. Removed unused functions * Performance fixes using hashes * Minor improvements * Generalized sync async html and removed unused functions * Cleaned up and unified functionality * Fixed CF and hyperlink bugs. Removed classDiagram * Fixed hyperlinks and unnecesary whitespaces after * Fixed not adding whitespaces where appropriate * Added containsErrors cf * Added cf_Between shouldApply with edge cases and missmatches * Added fix for calculatedFormula issues * Fixed cell value set bug and simplified between * Added simplifications, bug fix and test * Added Averages to exporter/shouldApply * Added should apply for timeGroup between greater than and less than * Added standardDeviation should apply * Added unique shouldApply * Added TopBottom function * Added basic twoColorScale implementation * Ensured range functionality on headers and easier implementation of future special cases * Added faulty 3 color * Ensured Threerange is correct when values non-linear * Started adding databar * Half-made databar * Added better chaching of cellValues * removed empty line * Ensured removal of tempExport Data. Positive databar implementation * further partial databar implementation * Fixed text-alignment and color scale dissapear issues * Adding Databar functionality * Added databar border and moved to css * Added axis position start * Added variable axis position in html exporter for databars * Added horizontal and vertical text-alignment to databars * Added databar solution to header * Start of shared formulas for cfs * Added dynamically calculated formulas to cfs * Resolved Token list not clearing on between bug * Simplification of css data gathering and cleanup * Added highly innefficent colName solution * Fixed notbetween handling * Added null-handling for cellIs shouldApply functions * Fixes for text functions * Fixes for end users * Fixes issue #1292 * Bug/s608 first sheet deletion (#1294) * Beggining of solution * Simplified solution. Added tests and exception * Cleanup * Fixes issue #1298 * Added test * Fixed test * Fixes issue #1298 (#1299) * Fixes issue #1298 * Added test * Fixed test * EPPlus version 7.0.9 * Fixes issue #1302 * Fixes issue 1304 * Resolved null-reference bugs and spell-checked "extentions" * Ensured top/bottom can handle error and other values correctly * Removed stale exception * Fixes issue #1308 * Fixes #1313. Better handling of defined names and encode ExcelNamedRange.NameValue property on save * Ensured shouldApply as appropriate * Added new test class * Bugfixing * Bug/s615 data validation read (#1307) * Added new test removed issue test * Added readwrite to test for confirmation * Added fixed issues * Secured DataValidation reading. Fixed i1312 * Non-working strict solution * Resolved dataValidation read issues. Added docs * Cleanup and commenting * Make test happy in production --------- Co-authored-by: Jan Källman <[email protected]> * Fixes issue #1320 (#1322) * Bug/issue1321 (#1324) * Fixes issue #1320 * Fixes issue #1321 * Added CellStore Test * #1329 - adjusted ActiveTab when moving worksheets * #1327 - EPPlus removed all styling when setting a Table's CalculatedFormula to an empty string * #1327 - fixed failing unit test, added ClearFormulas call * #1332 - Intersect operator was replaced with 'isc' when copying cells (#1333) * #1332 - Intersect operator was replaced with 'isc' when copying cells * #1332 - removed the added static DefaultPreserveWhiteSpace from SourceCodeTokenizer * Fixes issue #1338 * Updated fixed issues * Fixed text contains error * Fixes issue #1341 * Bug/issue1338 (#1340) * Fixes issue #1338 * Updated fixed issues * Colorscale bugfix * Added fix for two colorscale as well * EPPlus version 7.0.10 * Fixes #1343. Writing and loading pivot table attribute on CFs (#1344) * Fixes #1343. Writing and loading pivot table attribute on CFs * Added docs * Bug/s635 insert row (#1346) * Fixes #1345 fixed read exception faulty while loop * Added template-free test * fixed LastToken and added docs --------- Co-authored-by: Jan Källman <[email protected]> * Fixed databars, table alignment, flagging conditionalFormatting as optional * Cleanup comments usings and top of file * Removal of databars + cleanup --------- Co-authored-by: JanKallman <[email protected]> Co-authored-by: swmal <[email protected]> * pseudocode for fixed width * Pseudocode for reading fixed width * Emergency fill fix (#1357) * Fixed Width text reading. * Feature/rich text (#1352) * Fixes issue #1292 * Bug/s608 first sheet deletion (#1294) * Beggining of solution * Simplified solution. Added tests and exception * Cleanup * Fixes issue #1298 * Added test * Fixed test * Fixes issue #1298 (#1299) * Fixes issue #1298 * Added test * Fixed test * EPPlus version 7.0.9 * Fixes issue #1302 * Fixes issue 1304 * Fixes issue #1308 * Fixes #1313. Better handling of defined names and encode ExcelNamedRange.NameValue property on save * Added new test class * Bug/s615 data validation read (#1307) * Added new test removed issue test * Added readwrite to test for confirmation * Added fixed issues * Secured DataValidation reading. Fixed i1312 * Non-working strict solution * Resolved dataValidation read issues. Added docs * Cleanup and commenting * Make test happy in production --------- Co-authored-by: Jan Källman <[email protected]> * Fixes issue #1320 (#1322) * Bug/issue1321 (#1324) * Fixes issue #1320 * Fixes issue #1321 * Added CellStore Test * #1329 - adjusted ActiveTab when moving worksheets * #1327 - EPPlus removed all styling when setting a Table's CalculatedFormula to an empty string * Progress on RichText optmimzation. * Added more tests * Fixed color auto property not being read properly * #1327 - fixed failing unit test, added ClearFormulas call * Deleted old files and fixing tests. * #1332 - Intersect operator was replaced with 'isc' when copying cells (#1333) * #1332 - Intersect operator was replaced with 'isc' when copying cells * #1332 - removed the added static DefaultPreserveWhiteSpace from SourceCodeTokenizer * Fixed some more tests not passing. * Updated a test. * Fixes issue #1338 * Updated fixed issues * Fixes issue #1341 * Bug/issue1338 (#1340) * Fixes issue #1338 * Updated fixed issues * EPPlus version 7.0.10 * Fixed rich text for more tests. * Fixes issue #1335 * Fixes #1343. Writing and loading pivot table attribute on CFs (#1344) * Fixes #1343. Writing and loading pivot table attribute on CFs * Added docs * Bug/s635 insert row (#1346) * Fixes #1345 fixed read exception faulty while loop * Added template-free test * fixed LastToken and added docs --------- Co-authored-by: Jan Källman <[email protected]> * Fixed richtext issues. * Fixed issue when having multiple spaces is a intersect operator and use keep whitespaces * Fixed issue with rich text comments not being saved & rich text attrobutes not being copied. * Cleaned up richtexttests * Added copy worksheet test for richtext * Removed RichTextAttributes and using properties again. * Moved files and deleted new folder. * Fixed GetIndexColor - as it has been moved to Styles * Fixed some issues with failed tests * Ensured mergedcells border can be null * Fixed remove in ExcelParagraphCollection. * Removed commented code. --------- Co-authored-by: JanKallman <[email protected]> Co-authored-by: OssianEPPlus <[email protected]> Co-authored-by: swmal <[email protected]> Co-authored-by: Ossian Edström <[email protected]> * Fixed a few bugs in the new html export * Progress on Reading fixed width column text files. * Fixed return range * Changed output path in TableExporterTests * Changed so user now need to set the column lengths in exceltextformat instead of passing it to the read method. * Started working on support for reading fixed width text files from position. * Read fixed width files with post start positions Read specified columns * Read fixed width from fileinfo and specify conditions for readin rows with Func * Started work on saving fixed width text. * Added test and exportconditionalformatting.xlsx in the workbooks folder * Save fixed width files * Save fixed width file progress * Refactoring reading and saving fixed width text files. Now has a properties for each column. * Fixed duplicates ignore case * Made priority work by inversing Order * Fixed Width test reading and saving. * Fixed sometimes empty _baseFormula * Cleanup and bugfix. Fixed cf style read, added comments, ensured priority reads correctly * Fixed breaking change * #1301 - initial implementation of NumberFormatProvider in LoadFromCollection (#1381) Co-authored-by: swmal <{ID}+username}@users.noreply.github.com> * Fixed failing test s312 * Support for excluding rows and columns when saving CSV * Added xml comments. Fixed issues with failing tests. * Added name property to fixed width reading. * Test for example * changed named of variables for clarity & updated xml comments. * Load from text to transpose, csv & fixed width * Fixed Text width transpose test * Fixes issue #1421 (#1422) * Fix exception message in automapping in ToCollection (#1423) * Fix #1416 nullable members in LoadFromCollection() (#1417) * Fix #1416 nullable members in FromCollection * Replaced issue test with more appropriate thourough test * Added comments and ensuring headers * EPPlus version 7.1.2 * Updated release date in version history * Fixed isses wth fixed wiidth * Changed how reading and saving using positions in fixed width files. * fixed small reading fixed width issue * added validation on position values. * DataValidation lists can now read showDropDown=0 (#1430) * DataValidation lists can now read showDropDown=0 * Added fixed issues * Fixed issues regarding usability * Fixed cultureInfo issue in test * Added xml documentations * Fixes issue #1435 - Name indexer on group drawings did not work. * Ensured correct read write of custom iconset and gte (#1433) * build: Use central package management (#1424) * build: Use central package management * build: Fix `DefineConstants` value for test project --------- Co-authored-by: Jan Källman <[email protected]> * Fixed issues with csv exporting * Bug/i1423 (#1437) * Ensured clearing * Failing test for remove. Cannot remove individual cells * Functional non-optimized rangeDictionary fix * Added ClearRows method. Resolved Edge case * Simplified * Compressed and simplified further * Cleanup * Added fixed issues * cleaned up comment * Fixed some faing tests and removed some other tests * FIxed some tests. Refactoring names * ColumnLengths fix * fixed width can now take -1 as last parameter to read until eol. * Minor refactoring and added new tests * Fixed some issues with fixed width reading, added async saving. --------- Co-authored-by: Mats Alm <[email protected]> Co-authored-by: swmal <{ID}+username}@users.noreply.github.com> Co-authored-by: OssianEPPlus <[email protected]> Co-authored-by: JanKallman <[email protected]> Co-authored-by: Ossian Edström <[email protected]> Co-authored-by: Antonis Kordatzakis <[email protected]> * Added calculate to tests * WIP:Added PivotShowAsDifference * Expanded tests * Further tests * Basefield fix * Fixed several warnings * Fixed ShowAsDifferenceOf calculation * WIP:Redesign ShowAsDifference * Some fixed on ShowAs-Difference * Fix/s671 cf in pivot (#1451) * Fixed several warnings * Fixed reading and writing of pivot CFs * WIP:Changed ShowAs Running Total calculation * Fixed test text files to copy if newer on build * Fixed merge issue * Redesigned ShowAs-Running Total calculations.Added more tests * Implemented LET function (#1459) * Added a test for LET and started work on tokenizer * work on let function * First implementation of LET function * Wip * More work on LET function * Intial LET function implementation * Added unit test for LET and small performance improvement in RpnFormulaExecution for LET * Removed unnecessary using statement and empty if-statement --------- Co-authored-by: swmal <{ID}+username}@users.noreply.github.com> * Fix/cf advanced theme colors (#1460) * Ensured theme colors work with cfs and html export * Fixed assert for test * Minor comment fix * Removed old comment * Fixes for pr comments * Removed uncommented code * Fix/removing warnings (#1449) * More warning fixes * Added xml comments and removed unused files * Make rangeBaseAsync actually async * Fix overrides and 3.5 optional comments * added fixes * Fixed skiprow bug * Set several public classes as internal in the formula parser, that should not be exposed. --------- Co-authored-by: JanKallman <[email protected]> * Added new properties FirstValueCell, LastValueCell and DimensionByValue properties to ExcelWorksheet * Added text to fixedissues.md * Removed out-commented code * Changed Text function back to public * Transpose tests and table column bugfix (#1456) * Transpose tests * Fixed table column bug * Ensured column counting is correct * Fixed table column names * Ensured coherence with previous behaviour * Added alternative to not overwrite empty cells when overwriting column names * Unified option * Clearer names. * Ammended names and comment for clarity * Removed deleted namespaces * Added fixed issues * Added new overload to GetValue * Fixed some issues with Pivot Table calculations * Feature/copy drawings (#1472) * copyDrawings progress * CopyCharts are working now... * Copy drawings * copy control vml * copy drawing controls progress * Copy slicers & fixing copy issues. * Fixed issues with copying drawings * renamed some variables * Refactor copy drawings code * copy drawing control * Groupshape copy progress. * fixed copy slicer issue * fixed smaller issues with slicer copy * Fixed settings new name to copied drawings and tests * Pivot table slicer progress * Fixed slicer issues. * Copy drawings on ranges * Fixes issue #1474 and #1476 * fixed issue #1475 (#1479) * fixed issue #1475 * removed unnecesry usings * Fixed meta data for #Spill! errors * Renamed method * Removed incorrect . * Changed md file * Update fixedissues.md * Added fixed issues * Added fixed issues2 * Fixes issue #1483, #1486. Fixed an issue with DimensionByValue. --------- Co-authored-by: AdrianEPPlus <[email protected]> Co-authored-by: OssianEPPlus <[email protected]> Co-authored-by: Ossian Edström <[email protected]> Co-authored-by: Mats Alm <[email protected]> Co-authored-by: swmal <{ID}+username}@users.noreply.github.com> Co-authored-by: Antonis Kordatzakis <[email protected]>
1 parent 1362fdb commit 55ac136

File tree

432 files changed

+23845
-4409
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

432 files changed

+23845
-4409
lines changed

docs/articles/breakingchanges.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,4 +125,9 @@ Misspelled property `ExcelIgnoreError.CalculatedColumm` has been renamed `Calcul
125125
* When reading conditional formatting from file Style.Fill.PatternType is now always null if the patternType attribute in the xml has not been set.
126126
#### Rich Text
127127
* The `ExcelRichText._collection` has been set to internal.
128-
* Public static methods in the class `XmlHelper` used to getting richtext properties has been changed to internal.
128+
* Public static methods in the class `XmlHelper` used to getting richtext properties has been changed to internal.
129+
130+
131+
### Breaking Change From EPPlus 7.2
132+
* Changed class ExcelTextFormatBase to abstract
133+
* OfficeOpenXml.FormulaParsing.ExcelUtilities.ExcelReferenceType RelativeRowAbsolutColumn corrected to RelativeRowAbsoluteColumn

docs/articles/fixedissues.md

Lines changed: 54 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,53 @@
11
# Features / Fixed issues - EPPlus 7
2+
## Version 7.2
3+
### Features
4+
* Added support for calculating pivot tables - See https://github.com/EPPlusSoftware/EPPlus/wiki/Calculating-Pivot-tables
5+
* Supports calculation of data fields on column and row fields.
6+
* Page field filtering
7+
* Filters
8+
* Slicers
9+
* Show data as on data fields
10+
* Calculated fields.
11+
* Access calculated pivot table data via the ExcelPivotTable.CalculatedData property of the ExcelPivotTable.GetPivotData function
12+
* GetPivotData function.
13+
* Added support for copying drawings.
14+
* Many types of drawings:
15+
* Shapes
16+
* Charts
17+
* Pictures
18+
* Controls
19+
* Slicers
20+
* Group Shapes
21+
* Copy individual drawings.
22+
* Copying a range will include drawings.
23+
* Set flag to ignore drawings.
24+
* Added support for importing and exporting Fixed Width text files.
25+
* Transpose
26+
* Transpose ranges in import and export functions.
27+
* Transpose i range Copy.
28+
* New functions supported in formula calculations.
29+
* GETPIVOTDATA
30+
* MMULT
31+
* MINVERSE
32+
* MDETERM
33+
* MUNIT
34+
* TEXTSPLIT
35+
* TEXTAFTER
36+
* TEXTBEFORE
37+
* LET
38+
* Added Full-fledged support for Iconsets and Databar conditionalformattings in HTML-exporter, New features include:
39+
* Exporting full visuals of Positive and negative databars with borders and axis colors, position and bar direction
40+
* Custom-made embeded .svgs similar to each icon excel supports.
41+
* Custom iconsets displaying appropriately and in order.
42+
* Icons moving with text when aligned top, middle or bottom as in excel.
43+
* Theme colors for colorscales now work correctly in the HTML exporter
44+
45+
### Minor Features and fixed issues
46+
* Cell text/content now default to vertical-align bottom as data in excel cells are bottom-aligned by default.
47+
* Added new properties `FirstValueCell`, `LastValueCell` and `DimensionByValue` to ExcelWorksheet to manage cell value boundries for a worksheet.
48+
* Added ManualLayout property for data labels on charts. Labels can now be positioned and their textbox resized directly. Accessed via e.g `Chart.Series[0].DataLabel.DataLabels[0].Layout.ManualLayout`
49+
* Conditional Formatting Color Scales now support theme color correctly.
50+
251
## Version 7.1.3
352
### Fixed issues
453
* Dxf styles on tables got corrupt if a style contained an alignment and border element.
@@ -12,6 +61,10 @@
1261
* Loading a workbook with rich text elements with no style element could hang.
1362
* The rich text `Text` property was not decode for restricted characters.
1463

64+
* Table Column Names
65+
* ShowHeaders = True property on tables no longer causes crash in rare cases. It also no longer updates column names.
66+
* Table.SyncColumnNames method added to ensures column names and cell-values in header are equal. Applying this method should cover any potential issues caused by above fix not updating column names.
67+
* Adding a table column to a table no longer creates a column name that can conflict with existing names.
1568
## Version 7.1.2
1669
### Fixed issues
1770
* Defined Names with `"` symbols no longer get extraneous `"` added when saving in EPPlus.
@@ -1186,4 +1239,4 @@ These overloads have been deprecated:
11861239
* _Formula calc_: Does not remove double-negation from formulatokens.
11871240
* _Formula calc_: Value matcher now supports comparisons between DateTime and double. CompileResultFactory includes float type in DataType.Decimal.
11881241
* _Formula calc_: MultipleRangeCriterasFunction.GetMatchIndexes() looped through max number of rows when a range argument was an entire column now stops as Dimension.End.Row. Fixed a bug in CountIfs function which wasn't working properly with multiple criteria's
1189-
* _Formula calc_: Support Instance_num parameter of SUBSTITUTE function.
1242+
* _Formula calc_: Support Instance_num parameter of SUBSTITUTE function.

src/.editorconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ csharp_style_prefer_null_check_over_type_check = true:suggestion
2525
csharp_prefer_simple_default_expression = true:suggestion
2626
csharp_style_prefer_local_over_anonymous_function = true:suggestion
2727
csharp_space_around_binary_operators = before_and_after
28+
csharp_style_prefer_primary_constructors = true:suggestion
2829
[*.{cs,vb}]
2930
#### Naming styles ####
3031

src/EPPlus.System.Drawing/Drawing/Image/SystemDrawingImageHandler.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public bool GetImageBounds(MemoryStream image, ePictureType type, out double wid
5050
{
5151
try
5252
{
53-
var bmp = new Bitmap(image);
53+
Bitmap bmp = new Bitmap(image);
5454
width = bmp.Width;
5555
height = bmp.Height;
5656
horizontalResolution = bmp.HorizontalResolution;

src/EPPlus/ConditionalFormatting/Contracts/IExcelConditionalFormattingIconSetGroup.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public interface IExcelConditionalFormattingIconSetGroup<T>
4242
bool Custom { get; }
4343

4444
/// <summary>
45-
/// IconSet (3, 4 ou 5 IconSet)
45+
/// IconSet (3, 4 or 5 IconSet)
4646
/// </summary>
4747
T IconSet { get; set; }
4848
#endregion Public Properties

src/EPPlus/ConditionalFormatting/Contracts/IRangeConditionalFormatting.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -294,11 +294,9 @@ public interface IRangeConditionalFormatting
294294
IExcelConditionalFormattingDataBarGroup AddDatabar(Color color);
295295

296296
/// <summary>
297-
/// Get dict of all CFs and their addresses in range
297+
/// Get a list of all conditional formatting rules that exist on cells in the range
298298
/// </summary>
299299
/// <returns></returns>
300-
//Dictionary<string, List<ExcelConditionalFormattingRule>> GetConditionalFormattings();
301-
302300
List<ExcelConditionalFormattingRule> GetConditionalFormattings();
303301
}
304302
}

src/EPPlus/ConditionalFormatting/ExcelConditionalFormattingColorScaleValue.cs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ Date Author Change
1818

1919
namespace OfficeOpenXml.ConditionalFormatting
2020
{
21+
/// <summary>
22+
///
23+
/// </summary>
2124
public class ExcelConditionalFormattingColorScaleValue
2225
{
2326
int _priority;
@@ -26,10 +29,11 @@ public class ExcelConditionalFormattingColorScaleValue
2629
Color color,
2730
double value,
2831
string formula,
29-
int priority)
32+
int priority,
33+
ExcelStyles styles)
3034
{
3135
Type = (eExcelConditionalFormattingValueObjectType)type;
32-
_colorSettings = new ExcelDxfColor(null, eStyleClass.Fill, SetColor);
36+
_colorSettings = new ExcelDxfColor(styles, eStyleClass.Fill, SetColor);
3337
Color = color;
3438
Value = value;
3539
if(Type != eExcelConditionalFormattingValueObjectType.Percentile)
@@ -42,8 +46,8 @@ public class ExcelConditionalFormattingColorScaleValue
4246
internal ExcelConditionalFormattingColorScaleValue(
4347
eExcelConditionalFormattingValueObjectType? type,
4448
Color color,
45-
int priority)
46-
: this(type, color, double.NaN, null, priority)
49+
int priority, ExcelStyles styles)
50+
: this(type, color, double.NaN, null, priority, styles)
4751
{
4852
}
4953

src/EPPlus/ConditionalFormatting/ExcelConditionalFormattingEnums.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -873,7 +873,7 @@ public enum eExcelconditionalFormattingCustomIcon
873873
/// </summary>
874874
GreenCheckSymbol = 0x62,
875875

876-
//3Symbols2
876+
//3Symbols
877877
//--------
878878

879879
/// <summary>

src/EPPlus/ConditionalFormatting/ExcelConditionalFormattingIconDatabarValue.cs

Lines changed: 80 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,13 @@ Date Author Change
1111
01/27/2020 EPPlus Software AB Initial release EPPlus 5
1212
07/07/2023 EPPlus Software AB Epplus 7
1313
*************************************************************************************************/
14+
using OfficeOpenXml.FormulaParsing.Excel.Functions.RefAndLookup;
1415
using OfficeOpenXml.Style.Dxf;
1516
using System;
1617
using System.Collections.Generic;
1718
using System.Linq;
19+
using OfficeOpenXml.FormulaParsing.Utilities;
20+
using OfficeOpenXml.FormulaParsing.Excel.Functions.MathFunctions;
1821

1922
namespace OfficeOpenXml.ConditionalFormatting
2023
{
@@ -25,7 +28,6 @@ namespace OfficeOpenXml.ConditionalFormatting
2528
public class ExcelConditionalFormattingIconDataBarValue
2629
{
2730
private eExcelConditionalFormattingRuleType _ruleType;
28-
ExcelConditionalFormattingRule _rule;
2931

3032
internal bool HasValueOrFormula
3133
{
@@ -84,9 +86,7 @@ internal ExcelConditionalFormattingIconDataBarValue(
8486

8587
internal void SetCustomIconStringAndId(string set, int id)
8688
{
87-
int myKey = _iconStringSetDictionary.FirstOrDefault(x => x.Value == set).Key << 4;
88-
myKey += id;
89-
CustomIcon = (eExcelconditionalFormattingCustomIcon)myKey;
89+
CustomIcon = IconDict.GetIconAtIndex(set, id);
9090
}
9191

9292
internal virtual string GetCustomIconStringValue()
@@ -153,6 +153,8 @@ public eExcelConditionalFormattingValueObjectType Type
153153

154154
private double? _value = double.NaN;
155155

156+
internal double _formulaCalculatedValue = double.NaN;
157+
156158
/// <summary>
157159
/// The value
158160
/// </summary>
@@ -226,5 +228,79 @@ public string Formula
226228
}
227229
}
228230
}
231+
232+
internal bool ShouldApplyIcon(double aValue)
233+
{
234+
double conditionValue = Value;
235+
236+
if(Type == eExcelConditionalFormattingValueObjectType.Formula)
237+
{
238+
conditionValue = _formulaCalculatedValue;
239+
}
240+
241+
if(aValue < conditionValue)
242+
{
243+
return false;
244+
}
245+
246+
if(aValue == conditionValue && GreaterThanOrEqualTo == false)
247+
{
248+
return false;
249+
}
250+
251+
return true;
252+
}
253+
254+
internal double GetCalculatedValue(double maxValue, double minValue, ExcelWorkbook wb, ExcelAddressBase address, ExcelAddress rangeAddress, List<object> values)
255+
{
256+
double calculatedValue;
257+
258+
switch(Type)
259+
{
260+
case eExcelConditionalFormattingValueObjectType.Max:
261+
case eExcelConditionalFormattingValueObjectType.AutoMax:
262+
calculatedValue = maxValue;
263+
break;
264+
case eExcelConditionalFormattingValueObjectType.Min:
265+
case eExcelConditionalFormattingValueObjectType.AutoMin:
266+
calculatedValue = minValue;
267+
break;
268+
case eExcelConditionalFormattingValueObjectType.Num:
269+
calculatedValue = Value;
270+
break;
271+
case eExcelConditionalFormattingValueObjectType.Percent:
272+
calculatedValue = ((Value * 0.01) * (maxValue - minValue)) + minValue;
273+
break;
274+
case eExcelConditionalFormattingValueObjectType.Percentile:
275+
var percentileResult = wb.FormulaParserManager.Parse(
276+
$"PERCENTILE.INC({rangeAddress.AddressSpaceSeparated}, {(Value * 0.01).ToString(System.Globalization.CultureInfo.InvariantCulture)})", address.FullAddress, false
277+
);
278+
if (percentileResult.IsNumeric())
279+
{
280+
_formulaCalculatedValue = Convert.ToDouble(percentileResult);
281+
calculatedValue = _formulaCalculatedValue;
282+
}
283+
else
284+
{
285+
throw new Exception($"The databar percentile input '{Value}' must be a numeric value. Error found in databar conditional formatting at cell {address.Address}");
286+
}
287+
break;
288+
case eExcelConditionalFormattingValueObjectType.Formula:
289+
var formulaResult = wb.FormulaParserManager.Parse(Formula, address.FullAddress, false);
290+
if (formulaResult.IsNumeric())
291+
{
292+
_formulaCalculatedValue = Convert.ToDouble(formulaResult);
293+
calculatedValue = _formulaCalculatedValue;
294+
}
295+
else
296+
{
297+
throw new Exception($"The databar formula '{Formula}' must return a numeric value. Error found in databar conditional formatting at cell {address.Address}");
298+
}
299+
break;
300+
default:
301+
throw new NotImplementedException($"The type {Type} has not been implemented. Error found in databar conditional formatting at cell {address.Address}");
302+
}
303+
return calculatedValue;
304+
}
229305
}
230306
}

0 commit comments

Comments
 (0)