Commit Graph

485 Commits

Author SHA1 Message Date
MarkBaker 27221ee8cf Update Change Log 2022-04-23 19:44:41 +02:00
Mark Baker f024259575
Merge branch 'master' into Ods-Writer-Freeze-Pane 2022-04-18 20:13:58 +02:00
MarkBaker 76f486d8e3 Initial work on supporting Freeze Pane for Ods Writer 2022-04-18 20:02:37 +02:00
oleibman 0afec91061
Change Log Updates (#2756)
Catch up on some undocumented changes.
2022-04-18 08:28:01 -07:00
andres1gb 4cd1d7039d
Fix reading of files in the root of a zip (#2731)
* Fix reading of files in the root of a zip

Xlsx.php relies in dirname($filename) for path generation. When path is a bare filename (i.e. files in the root of the zip file), dirname($filename) returns a relative path to the current directory ("."). This is ok for filesystems, but not when accesing contents in a zip file.

Xlsx documents with files in the root of the zip container are not common, but legit. I've found it to happen in files generated by Google Campaign Manager 360.

* Update Xlsx.php

* Update Xlsx.php

* Update CHANGELOG.md

* Add files via upload

* Create XlsxRootZipFilesTest.php

* Update XlsxRootZipFilesTest.php

* Add files via upload

* Delete rootZipFiles.xlsx

* Update XlsxRootZipFilesTest.php

* Update Xlsx.php
2022-04-18 06:54:41 -07:00
MarkBaker ea584301c7 Modify Autosize calculation to make allowance for the filter dropdown icon in the first row of an AutoFilter range 2022-04-17 21:59:52 +02:00
MarkBaker 7a2f5c4ccc Ods Writer support for setting column width/row height (including Autosizing) 2022-04-17 11:34:39 +02:00
MarkBaker 19988626d4 Fix change log typo 2022-04-13 18:17:29 +02:00
Mark Baker 8b83e8ac4c
Merge branch 'master' into Issue-2730_Combined-Ranges 2022-04-13 18:04:00 +02:00
MarkBaker 40730c6023 Handle defined names with the range operator.
It gets awkward when the defined name is for an actual range rather than for an individual named cell; because we need to manipulate the stack when that happens.

The code is ugly, and this is a rather simplistic approach, but it works as long as the named range is a cell, a cell range, or even a "chained" range - it won't work if we have union or intersection operators in the defined range - but it does provide formula support that never existed before.
2022-04-13 17:55:51 +02:00
Mark Baker 2f52cd8644
Merge branch 'master' into fix-external-sheet-column-styles 2022-04-13 12:25:32 +02:00
mjan4175 5f317250b3 CHANGELOG.md contribution 2022-04-12 19:43:42 +02:00
MarkBaker f672734258 Typo 2022-04-12 08:35:40 +02:00
mjan4175 5719b21341 FIX: Changelog revert unwanted changes 2022-04-11 09:39:53 +02:00
mjan4175 43e0e64cd4 CHANGELOG.md contribution 2022-04-11 09:31:07 +02:00
MarkBaker 6b4ffda5ae Add functionality to adjust CellRange by "modifying" the from/to CellAddress Value objects 2022-04-01 15:41:55 +02:00
MarkBaker 62238bc011 Initial work on deprecating `ByColumnAndRow` methods; and providing functionality to use the basic cellAddress methods to be used with a string cell address (e.g. `C5`); an array of columnId and rowId (e.g. `[3, 5]`) or a new CellAddress object.
Current implementation for all methods that take a single cell reference argument:
 - `setCellValue()`
 - `setCellValueExplicit()`
 - `getCell()`
 - `cellExists()`
 - `setBreak()`
 - `freezePane()`
 - `getComment()`

Also introducing a CellRange object to work with similar cases for methods that accept a cell range rather than simply a cell address; and RowRange/ColumnRange objects for those cases.

Still need to apply to methods that accept a cell range or single cell:
 - `mergeCells()`
 - `unmergeCells()`
 - `protectCells()`
 - `unprotectCells()`
 - `setAutoFilter()`

Then there's a few special cases that accept row and column ranges, not simply cell ranges; or a series of cell ranges.
2022-03-31 23:22:48 +02:00
MarkBaker 7f00049fe8 Initial work on the SORT() and SORTBY() Lookup/Reference functions
The code could stil do with some cleaning up, and better optimisation for memory usage; but all tests are passing... that's for full multi-level sorting (including direction), and allowing for correct sorting of sting/numeric datatypes.
2022-03-24 12:21:27 +01:00
MarkBaker f3bb61f3e4 Initial work implementing the FILTER() Lookup/Reference function
Tighten up on vector formats; and provide a couple of helper methods for testing row/column vectors
2022-03-20 18:01:30 +01:00
MarkBaker 0a9d15407f Suport fill style and color for reading CF Formats 2022-03-19 19:47:14 +01:00
Mark Baker 23e2d702ff
Merge branch 'master' into Xls-Reader-Conditional-Formatting 2022-03-19 16:21:14 +01:00
MarkBaker be8c444951 More minor tweaks 2022-03-19 16:15:48 +01:00
Mark Baker d93f1b2800
Merge branch 'master' into simple-cache-2 2022-03-18 23:05:33 +01:00
MarkBaker c8cf193301 Initial work implementing the new UNIQUE() Lookup/Reference array function 2022-03-18 14:18:37 +01:00
MarkBaker 6faf828db7 Fix issues with updating Conditional Formatting when inserting/deleting rows/columns
- Update existing ranges, expanding if necessary, rather than trying to clone for each individual cell
 - Update conditions, so that cell references and formulae are maintained correctly

Note that absolute as well as relative cell references should be updated in conditions
2022-03-17 11:37:15 +01:00
MarkBaker ec15c7a6de more minor tweaks 2022-03-16 23:03:19 +01:00
MarkBaker bbe6b8082e Some additional unit tests for the ReferenceHelper
And a bugfix when deleting cells that contain hyperlinks (the hperlinks weren't being deleted, so were being "inherited" by whatever cell moved to that address)
2022-03-16 16:38:08 +01:00
MarkBaker 7101da80a5 Update Change Log 2022-03-13 11:12:59 +01:00
MarkBaker b208c52107 Fix for setting Active Sheet to the first loaded worksheet when `bookViews` element isn't defined (e.g. when file is created from Google Sheets) 2022-03-11 21:31:17 +01:00
Kevin Bond 3a4da89bfe
allow psr/simple-cache 2.x 2022-03-11 11:33:16 -05:00
MarkBaker 1801f582f5 Correction to Change Log 2022-03-10 10:24:28 +01:00
naotake51 572f4e94bd
Add two cell anchor drawing (#2532)
* Add two cell anhor drawing.

* Add "Support for two cell anchor drawing of images." to CHANGELOG.md

* Add pull-request link to "Support for two cell anchor drawing of images." of CHANGELOG.md
2022-03-09 19:21:47 -08:00
MarkBaker dbf25f0721 Set Selected Cells for Worksheets in Gnumeric Loader 2022-03-05 19:24:21 +01:00
MarkBaker cba0e13b2a Escape double quotes in a string value unless it's an empty string value 2022-03-05 12:44:44 +01:00
MarkBaker 16ad02bca8 Minor updates to te change log 2022-03-05 10:56:14 +01:00
MarkBaker 45ca934a53 Update Change Log and Documentation 2022-03-02 12:33:20 +01:00
MarkBaker f3d5028518 Work on setting up locale-aware formatted number conversion for the Csv Reader
Unit tests for locale-aware boolean conversion for Csv Reader
2022-03-02 08:53:29 +01:00
MarkBaker b31d42c52f Some Refactoring of the Ods Reader, moving all formula and address translation from Ods to Excel into a separate class to eliminate code duplication 2022-02-27 13:31:24 +01:00
MarkBaker 138638ad57 Ensure that selected worksheet is correctly set from Gnumeric Reader 2022-02-26 16:00:28 +01:00
MarkBaker 2af0b66f5f Read number formatting for Gnumeric... highlighted as not occurring when reading date values 2022-02-26 15:20:00 +01:00
Thorsten Ho 0cb60a5098
Fix XLSX broken vertical align font style (#2619)
* Fix XLSX broken vertical align font style

* Add fix information to changelog

* Fix phpcs issues
2022-02-23 20:23:59 -08:00
Mark Baker db21d043fe
Implementation of the ISREF() information function (#2613) 2022-02-21 18:47:23 +01:00
Mark Baker d5dc58d20e
Extract information functions (#2605)
* Split Information functions into a dedicated class and namespace and categorise as Value or Error
* Refactor all error functions into the new ExcelError class
2022-02-19 13:53:17 +01:00
Adrien Crivelli 3c0004760d
Prepare changelog for next version 2022-02-18 14:01:46 +01:00
Adrien Crivelli 3a9e29b4f3
1.22.0 2022-02-18 13:57:07 +01:00
oleibman c9d1df8554
Update Changelog (#2587)
Catch up with some earlier changes.
2022-02-13 00:45:27 -08:00
Mark Baker de2fb1f438
Reset phpstan to level 8... there's too many issues working with mixed and needing to cast to a specific type like string; but the alternative for maintaining exact types is a unnecessar extra of code for explicit handling of casting with checks that we don't need when we know datatypes from manual viewing of the codebase (#2585) 2022-02-12 22:04:02 +01:00
Mark Baker 5d88c6b534
Merge branch 'master' into Issue-2551_Enable-Array-Readiness-for-Functions-Maths 2022-02-12 17:11:45 +01:00
MarkBaker 75213f5ee1 Enable array-readiness for more Math/Trig functions 2022-02-12 16:56:06 +01:00
Orkhan Ahmadov 0eeba6dc0c
`ReferenceHelper@insertNewBefore` checks for missing coordinates before replacing values (#2541)
* ReferenceHelper@insertNewBefore now changes for missing columns before replacing and deleting columns

* Changelog updated

* Fixed code style

* Added assertion for all cells. Change bugfix implementation to use `createNewCell` on Worksheet

* Additional assertions
2022-02-12 07:08:11 -08:00
MarkBaker f577dde178 Fix for DOLLARDE() and DOLLARFR() with negative dollar values
Additional argument validations
2022-02-11 13:19:44 +01:00
Mark Baker 291ea88a6c
Initial work enabling Excel function implementations for handling arrays as arguments when used in "array formulae". (#2562)
* Initial work enabling Excel function implementations for handling arrays as aguments when used in "array formulae".

So far:
 - handling for single argument functions
 - for functions where only one of the arguments is an array (a matrix or a row/column vector)
 - for when there are two array arguments, and one is a row vector, the other a column vector
 - for when there are either 2 row vectors, or 2 column vectors
 - for a matrix and either a row or column vector 

Will work ok, as long as there are no more than two array arguments; still need to identify the logic to apply when there are more than two arrays; or there are two that aren't an already supported row vector/column vector pairing (ie two matrices).

* Throw an exception if we have three or more array arguments (after flattening) passed to a supported function until we can identify the abstruse non-euclidian logic behind how Excel handles building, using and presenting those n-dimensional result arrays

* Implement array arguments for the DATE() function so that we can verify that paired arrays/vectors work with functions that support more than 2 arguments

* Implement array arguments for the many of the Math/Trig functions

* Update change log
2022-02-09 15:12:54 +01:00
Sebastian Nohn 0ff0187f1f
fix most recent changes to the changelog: (#2561)
- fix indentation
- add links to PRs
- put latest changes to the bottom of each section
2022-02-07 09:17:29 -08:00
Sebastian Nohn 454c01be51
Add support for one digit decimals (FORMAT_NUMBER_0, FORMAT_PERCENTAGE_0) (#2525)
* Add support for one digit decimals (FORMAT_NUMBER_0)

* Add support for one digit decimals (FORMAT_NUMBER_0, FORMAT_PERCENTAGE_0)

* adding tests for one digit numbers

* cleanup

* add failing test to block merge of this PR until #2555 has been merged

* fix code style

* fix test
2022-02-05 12:46:50 -08:00
Sebastian Nohn b5c03fc61f
Fix error in PercentageFormatter rounding (#2555)
* fix error in rounding percentages

* add tests for FORMAT_PERCENTAGE

* fix code style
2022-02-05 12:19:05 -08:00
Mark Baker 394b504050
Additional russian function translations (#2554)
* Additional Russian translations for Excel functions

* Update change log
2022-02-04 18:18:21 +01:00
Mark Baker 4d82df2bc6
Add unit test for erroneous translations from Russian to English, and a quick/dirty fix (#2534)
* Add unit test for erroneous translations from Russian to English, and a quick/dirty fix
* Additional translation unit tests with accented characters from Spanish, Bulgarian, Czech and Turkish
* Update Change Log
2022-02-04 16:22:22 +01:00
Mark Baker ebeed87db5
Initial implementation of the MS Excel RANDARRAY() MathTrig function (#2540)
* Initial implementation of the MS Excel RANDARRAY() MathTrig function
Update Change Log

* Unit Tests for RANDARRAY()
2022-01-31 22:29:03 +01:00
Mark Baker 26079174a0
Implementation of the SEQUENCE() Excel365 function (#2536)
* Implementation of the SEQUENCE() Excel365 function

Note that the Calculation Engine does not yet support the Spill operator, or spilling functions

* Handle the use-case of step = 0; and tests for exception handling for invalid arguments

* Update Change Log
2022-01-29 14:32:40 +01:00
oleibman aa29947e0d
Update Change Log (#2522)
Document a number of PRs merged since V21.
2022-01-23 14:55:59 -08:00
Mark Baker 4a04499bff
Read conditional styling for cell (#2491)
* Allow single-cell checks on conditional styles, even when the style is configured for a range of cells
* Work on the CellMatcher logic to evaluate Conditionals for a cell based on its value, and identify which conditional styles should be applied
* Refactor style merging and cell matching for conditional formatting into separate classes; this should make it easier to test, and easier to extend for other CF expressions subsequently
* Added support for containsErrors and notContainsErrors
* Initial work on a wizard to help simplify created Conditional Formatting rules, to ensure that the correct expressions are set
* Further work on extending the Conditional Formatting rules to cover more of the options that are available in MS Excel
* Prevent phpcs-fixer from removing class @method annotations, used to identify the signature for magic methods used in Wizard classes
* Implement `fromConditional()`` method to allow the creation of a CF Wizard from an existing Conditional
* Ensure that xlsx Reader picks up the timePeriod attribute for DatesOccurring CF Rules
* Allow Duplicates/Uniques CF Rules to be recognised in the Xlsx Reader
* Basic Xlsx reading of CF Rules/Styles from <extLst><ext><ConditinalFormattings> element, and not just the <ConditinalFormatting> element of the worksheet

* Add some validation for operands passed to the CF Wizards
 - remove any leading ``=` from formulae, because they'll be embedded into other formulae
 - unwrap any string literals from quotes, because that's also handled internally

Handle cross-worksheet cell references in cellReferences and Formulae/Expressions

* re-baseline phpstan

* Update Change Log with details of the CF Improvements
2022-01-22 19:18:26 +01:00
MarkBaker dee098b3d2 Prepare Change Log for next release 2022-01-22 18:39:14 +01:00
Adrien Crivelli 1a359d2ccb
1.21.0 2022-01-06 12:10:08 +01:00
oleibman 707b7d584e
Update Change Log (#2453)
I noticed, too late, that PR #2422 updated the Release 1.20 section of change log because there was no Unreleased section. Created the missing section, moved the comment for 2422, and added the rest of the changes that have taken place since 1.20.
2021-12-18 11:48:27 -08:00
leo-bsv a7f687fe5c
Xlsx image background in comments #1547 (#2422)
* XLSX Image background in comments

* XLSX-Image-Background-In-Comments (#1547)

* Test fixes, convertion for comment sizes from px to pt, fix for setting image sizes from zip, set image type

* Merge remote-tracking branch 'origin/XLSX-Image-Background-In-Comments' into XLSX-Image-Background-In-Comments

* Tests to check reloaded document.

Co-authored-by: Burkov Sergey
2021-12-17 06:10:59 -08:00
Adrien Crivelli 44436f270b
1.20.0 2021-11-24 00:23:42 +09:00
Vladislav Lyshenko 9dcfd9a5c2
Use standard temporary file for internal use of HTMLPurifier (#2383) 2021-11-23 23:45:43 +09:00
Adrien Crivelli 858e073063 Drop PHP 7.2
This is according to our formal, published, policy to only support
eol PHP after 6 months.

See https://phpspreadsheet.readthedocs.io/en/latest/#php-version-support
2021-11-01 12:01:54 +09:00
Adrien Crivelli 5ca5e3423d
Prepare changelog for next version 2021-11-01 10:59:01 +09:00
Adrien Crivelli a9ab55bfae
1.19.0 2021-11-01 00:09:20 +09:00
Adrien Crivelli 61e989aba5
Keep changelog entries on a single line 2021-11-01 00:04:32 +09:00
Adrien Crivelli 69f633420b
Merge branch 'master' into PHP8-Sane-Property-Names 2021-10-31 15:25:01 +09:00
Einar 7635b3f91a
Optimize applyFromArray by caching existing styles (#1785)
Prevent calling clone and getHashCode when not needed
because these calls are very expensive.

When applying styles to a range of cells can we cache the
styles we encounter along the way so we don't need to look
them up with getHashCode later.
2021-10-31 00:55:00 +09:00
Richard van Velzen 5b4b12f77b
Skip inner loops for empty/default read filter (#2223)
The optimization from #773 was not copied along in #1033, so restore it

Co-authored-by: Adrien Crivelli <adrien.crivelli@gmail.com>
2021-10-31 00:09:02 +09:00
oleibman e67f858c95
Update Change Log (#2359)
Preparatory to new release expected soon.
2021-10-30 09:04:32 +09:00
ayacoo 1f08f160ad
[FEATURE] Ability to stream to an Amazon S3 bucket (#2326)
Related #2249
2021-10-16 09:11:03 -07:00
oleibman 90b9decb8e
Xlsx Reader Better Namespace Handling Phase 1 Second Bugfix (#2303)
* Xlsx Reader Better Namespace Handling Phase 1 Second Bugfix

See issue #2301. The main problem in that issue had been introduced with 18.0 and had already ben fixed in master. However there was a subsequent problem that had been introduced in master, an undotted i uncrossed t with namespace handling. When using namespaces, need to call attributes() to access the attributes before trying to access them directly. Failure to do so in parseRichText caused fonts declared in Rich Text elements to be ignored.

* Add An Assertion

Addresses problem in 2301 that had already been fixed.
2021-09-27 16:59:45 -07:00
oleibman f50c287109
Update Changelog (#2302)
Add changes which have been merged since 18.0 release but have not yet been documented in change log.
2021-09-19 18:33:10 -07:00
Alayn Gortazar d0076343c4
Fix Reading XLSX files without styles.xml throws an exception. (#2247)
* Fix Reading XLSX files without styles.xml throws an exception.

* Bugfix, debugging code removed

* Fix Reading XLSX files without styles.xml throws an exception (rethinked)

* Fix Reading XLSX files without styles.xml throws an exception (rethinked)

* Style fixes

* Fix Spreadsheet loaded without styles cannot be written

* Replaced test files for empty styles.xml testing
2021-08-16 05:05:32 -07:00
James Lucas 92909d52f9 Update Changelog to reference Issue and PR 2021-07-21 05:53:49 -07:00
jarrett jordaan 795992835f
When image source is a URL, store the URL for use during extraction. (#2072)
When image source is a link store the link.
Add url mutator.

Update section in documentation on image extraction.
2021-06-24 10:50:44 +02:00
MarkBaker 16d0075640 Change log updates 2021-06-17 16:35:17 +02:00
MarkBaker 66cd68daea Update Change log 2021-06-13 22:41:10 +02:00
Mark Baker 05466e99ce
Html import dimension conversions (#2152)
Allows basic column width conversion when importing from Html that includes UoM... while not overly-sophisticated in converting units to MS Excel's column width units, it should allow import without errors

Also provides a general conversion helper class, and allows column width getters/setters to specify a UoM for easier usage
2021-06-11 17:29:49 +02:00
Mark Baker 19724e3217
Reader writer flags (#2136)
* Use of passing flags with Readers to identify whether speacial features such as loading charts should be enabled; no need to instantiate a reader and manually enable it before loading any more.

This is in preparation for supporting new "boolean" Reaer/Writer features, such as pivot tables

* Use of passing flags with Writers to identify whether speacial features such as loading charts should be enabled; no need to instantiate a writer and manually enable it before loading any more.

* Update documentation with details of changes to the StringValueBinder
2021-06-04 13:45:32 +02:00
MarkBaker 488701b748 Update documentation with details of changes to the StringValueBinder 2021-06-03 21:42:20 +02:00
MarkBaker 7f7ad28403 Prepare stub changelog for next release 2021-05-31 20:49:15 +02:00
MarkBaker 418cd304e8 Update changelog for release 2021-05-31 20:21:15 +02:00
MarkBaker 59aae8768f Update change log 2021-05-31 11:41:45 +02:00
MarkBaker 43dcd84520 Update change log 2021-05-29 13:43:40 +02:00
Matjaž Drolc 0b0f02206f fix: Set font size to 10 when given 0
This change restored behavior from PHP7 in PHP8. In PHP7 calling
setSize(0) resulted in font size being set to 10. The fix addresses
change to equal comparisons in PHP8. Extra comparison is added to keep
result from PHP7 in PHP8 for the setSize(0) case.
2021-05-29 11:17:25 +02:00
MarkBaker 004eacc49b Update changelog, and phpstan appeasement 2021-05-27 12:02:38 +02:00
MarkBaker 4089aede0a Resolve default values when a null argument is passed for HLOOKUP(), VLOOKUP() and ADDRESS() functions 2021-05-27 12:02:38 +02:00
Nathan Dench 992108cea7 Update Changelog 2021-05-20 21:26:20 +02:00
MarkBaker e83f862d0b Initial work on auto-building locale files for Exce functions 2021-05-20 20:41:09 +02:00
MarkBaker 7903827475 Deprecation notice in ChangeLog for the old Excel funcion implementations 2021-05-12 09:55:01 +02:00
oleibman d5492ac8ed
Merge branch 'master' into #984 2021-05-11 14:44:33 -07:00
Nathan Dench a96109d89b Update CHANGELOG.md with R1C1 conversion change 2021-05-07 14:34:05 +02:00
Mark Baker 5ee4fbf090
Implement basic autofilter ranges with Gnumeric Reader (#2057)
* Load basic autofilter ranges with Gnumeric Reader
* Handle null values passed to row height/column with/merged cells/autofilters
2021-05-04 22:32:12 +02:00
Mark Baker 83e55cffcc
First steps in the implementation of AutoFilters for ODS Reader and Writer (#2053)
* First steps in the implementation of AutoFilters for ODS Reader and Writer, starting with reading a basic AutoFilter range (ignoring row visibility, filter types and active filters for the moment).

And also some additional refactoring to extract the DefinedNames Reader into its own dedicated class as a part of overall code improvement... on the principle of "when working on a class, always try to leave the library codebase in a better state than you found it"

* Provide a basic Ods Writer implementation for AutoFilters
* AutoFilter Reader Test
* AutoFilter Writer Test
* Update Change Log
2021-05-02 22:00:48 +02:00