Commit Graph

3306 Commits

Author SHA1 Message Date
dependabot[bot] ed7efb05f0
Bump mpdf/mpdf from 8.0.17 to 8.1.1 (#2793)
Bumps [mpdf/mpdf](https://github.com/mpdf/mpdf) from 8.0.17 to 8.1.1.
- [Release notes](https://github.com/mpdf/mpdf/releases)
- [Changelog](https://github.com/mpdf/mpdf/blob/development/CHANGELOG.md)
- [Commits](https://github.com/mpdf/mpdf/compare/v8.0.17...v8.1.1)

---
updated-dependencies:
- dependency-name: mpdf/mpdf
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-05-01 07:17:07 -07:00
oleibman 766252ccb0
Real Errors Identified in Calculation by Scrutinizer (#2774)
* Real Errors Identified in Calculation by Scrutinizer

Before Scrutinizer broke, I took a look at the remaining 43 errors which it categorized as 'major'. Most of these were false positives, but, in the case of Calculation and Reader/Xlsx/Chart, I was able to determine that its analysis of some of the problems was correct. There is little point addressing the false positives until it starts working again, but we should fix the real errors.

This PR addresses the real errors in Calculation.
- A test for `$pCellParent` should have been a test  for `$pCellWorksheet`.
- A test for `$operand1Data['reference']` should have been a test for `$operand1Data['value']`.
- A test for `$operand2Data['reference']` should have been a test for `$operand2Data['value']`.

* Fix Attempt to Erroneously Call trim on Array

Fix #2780. Warning message is being issued when getting calculated value of cell with value `=INDIRECT(ADDRESS(ROW(),COLUMN()-2))/$C$4`. This appears to be the case for all recent (and probably not so recent) releases; it is not a result of changes to the code base. Fix added to this PR because the erring section of code was proximate to code already changed in the PR. Test added.

* Minor Code Changes

Apply some suggestions from @MarkBaker
2022-04-30 19:13:17 -07:00
oleibman 0a531cf1cd
Replace 'self' with self::class in 2 Modules (#2773)
PHP 8.2 is supposed to deprecate the use of `['self', 'functionname']` for callables, suggesting the use of `[self::class, 'functionname']` instead. We made this change in a recent PR, and, while I'm thinking about it, I'll fix the remaining 2 modules with this construction. Vlookup is already adequately covered in unit tests. Reader/Xls/MD5 is not; a unit test is added.
2022-04-30 18:36:24 -07:00
oleibman 450873b5fa
Real Errors Identified in Calculation by Scrutinizer (#2775)
Before Scrutinizer broke, I took a look at the remaining 43 errors which it categorized as 'major'. Most of these were false positives, but, in the case of Calculation and Reader/Xlsx/Chart, I was able to determine that its analysis of some of the problems was correct. There is little point addressing the false positives until it starts working again, but we should fix the real errors.

This PR addresses the real errors in Reader/Xlsx/Chart.
- An assignment to `$XaxisLable` should be an assignment to `$XaxisLabel`.
- An assignment to `$YaxisLable` should be an assignment to `$YaxisLabel`.
2022-04-30 17:43:18 -07:00
Mark Baker 7169648a64
Merge pull request #2786 from PHPOffice/Cell-Collection-Memory-Experiments
Improve memory performance for getSortedCoordinates() in the Cell Collection
2022-04-28 20:02:38 +02:00
MarkBaker 45be09e98b Minor tweaks to execution speed, including eliminating a method call on storing a cell 2022-04-28 19:43:12 +02:00
MarkBaker 0171709e7f The `sortCellReferenceArray()` in `Coordinate` should have returned cells ordered by row, then by column... but instead sorted by column, then row.
Fixed that bug, using a slightly faster algorithm for the sort index than the simple fix would have used, and modified the tests that didn't have the correct expected result :-(
2022-04-28 17:43:01 +02:00
MarkBaker 1924f3c1d7 Improved memory performance for getSortedCoordinates() in the Cell Collection; with minimal execution time overhead.
This is an important method, as it's called by the Reference Helper and for the Writer save() method; so users should see that improvement.
2022-04-28 16:02:49 +02:00
Mark Baker 533f41f879
Merge pull request #2782 from PHPOffice/New-Excel-Functions
Add "Not yet Implemented" stubs for 14 new Excel Functions
2022-04-27 12:44:12 +02:00
MarkBaker 6b1be8c09f Add "Not yet Implemented" stubs for 14 new Excel Functions
- TEXTBEFORE – Returns text that’s before delimiting characters
- TEXTAFTER – Returns text that’s after delimiting character
- TEXTSPLIT – Splits text into rows or columns using delimiters
- VSTACK – Stacks arrays vertically
- HSTACK – Stacks arrays horizontally
- TOROW – Returns the array as one row
- TOCOL – Returns the array as one column
- WRAPROWS – Wraps a row array into a 2D array
- WRAPCOLS – Wraps a column array into a 2D array
- TAKE – Returns rows or columns from array start or end
- DROP – Drops rows or columns from array start or end
- CHOOSEROWS – Returns the specified rows from an array
- CHOOSECOLS – Returns the specified columns from an array
- EXPAND – Expands an array to the specified dimensions
2022-04-27 12:25:18 +02:00
MarkBaker bbebc0e5b7 Prepare Change Log for next Release 2022-04-24 16:19:39 +02:00
MarkBaker 21e4cf6269 Prepare Change Log for Release 2022-04-24 15:53:10 +02:00
MarkBaker b72d91116f Update Change Log 2022-04-24 11:36:47 +02:00
Mark Baker 763e0de229
Merge pull request #2772 from oleibman/issue2768
Time Interval Formatting
2022-04-24 11:32:11 +02:00
Mark Baker da76f0d977
Merge branch 'master' into issue2768 2022-04-24 11:26:52 +02:00
oleibman c286fb8957 Minor Changes
Apply some suggestions from @MarkBaker
2022-04-23 21:42:32 -07:00
oleibman 7fe5ee84ea Time Interval Formatting
Fix #2768. DateFormatter handles only one of six special formats for time intervals `[h] [hh] [m] [mm] [s] [ss]`. This PR extends support to the rest. There should be no more than one of these in any format string. Although it certainly could make sense to treat `[d] [dd]` in the same manner, Excel does not seem to support those.

Interesting observations - hours and minutes are truncated (presumably because they may be followed by minutes and seconds), but seconds are rounded. Also, there are some floating point issues, which fortunately showed up for the example in the original issue. There, the time interval was 1.15, which should evaluate to a minutes value of 1656 (as it does in Excel). However, on my system it evaluated to 1655 because of a rounding error in the 13th decimal place. To overcome this, values are rounded to 10 decimal places before truncating.
2022-04-23 11:12:46 -07:00
MarkBaker 27221ee8cf Update Change Log 2022-04-23 19:44:41 +02:00
MarkBaker b6f9868042 Quickfix - default Worksheet in CellAddress constructor to null 2022-04-23 19:01:10 +02:00
Mark Baker 10d175e686
Merge pull request #2671 from aswinkumar863/Table-for-Xlsx
Initial implementation of Excel's tables feature
2022-04-23 18:48:19 +02:00
aswinkumar863 534cbc04c0
Accept table range as AddressRange and array
Table constructor now accepts AddressRange and array
of [$fromColumnIndex, $fromRow, $toColumnIndex, $toRow]
2022-04-23 18:43:38 +05:30
aswinkumar863 d414f139f1
Table name is now case insensitive
Table name comparison changed to UTF-8 aware and case insensitive
2022-04-23 18:42:11 +05:30
aswinkumar863 1d99dc8d76
Merge branch 'PHPOffice:master' into Table-for-Xlsx 2022-04-23 18:31:13 +05:30
MarkBaker ed11a41c19 Updates to the Issue template 2022-04-23 13:46:42 +02:00
MarkBaker 0facbe0c1b Fix typo in PR template 2022-04-23 13:35:56 +02:00
MarkBaker 76310a05fd Update PR Template 2022-04-23 13:35:09 +02:00
Mark Baker 8d7a85476b
Merge pull request #2771 from PHPOffice/Extract-Worksheet-Validations
Extract cell/range validations from Worksheet
2022-04-23 13:23:04 +02:00
MarkBaker 69edf61ed6 Extract cell/range validations from Worksheet and move into a separate Worksheet/Validations class as public static methods
Extract tryDefinedName logic from Worksheet, nd move into the Worksheet/Validations class as a public static method
Apply stricter validation to autofilter range arguments
2022-04-23 13:08:06 +02:00
Mark Baker 0d014822a0
Merge pull request #2767 from PHPOffice/CellCollection-Last-Loop-Adjust
Performance tweaks to cell collection
2022-04-22 16:01:25 +02:00
MarkBaker 8126e24faf Performance tweaks to cell collection
I suspect that scrutiniser may complain that the pass-by-reference values in an expression like `sscanf($coord, '%[A-Z]%d', $column, $row)` don't exist; but PHP handles that without issue, creating the variables as needed, and phpstan has no problems with that, so scrutiniser shouldn't treat it as an issue. There's no point in adding code (even if it's just pre-defining call-by-reference arguments) when it's unnecessary overhead.
2022-04-22 15:40:55 +02:00
Mark Baker f48044cb94
Merge pull request #2764 from PHPOffice/CellCollection-Performance-Tweaks
Performance tweaks to cell collection
2022-04-22 10:03:17 +02:00
MarkBaker b5e11b1307 Performance tweaks to cell collection 2022-04-21 13:32:42 +02:00
Mark Baker ee24f59af1
Merge pull request #2761 from PHPOffice/Reduce-Size-of-Cell-Collection-Unique-ID
Reduce size of Unique ID Prefix used for the Cell Collection
2022-04-20 20:42:51 +02:00
MarkBaker ad56616309 Reduce size of Unique ID Prefix used for the Cell Collection when "in memory" (reduces the per-cell memory overhead, while still retaining a unique prefix to ensure no clash between worksheet collections).
External cache (where multiple threads may be accessing the same cache with different workeets) still uses the same length and entropy in the prefix as before
2022-04-20 20:01:45 +02:00
MarkBaker 9275d0c59e Improved documentation for setting row height/column width 2022-04-19 16:42:34 +02:00
Mark Baker eabe0ca68a
Merge pull request #2757 from PHPOffice/Issue-2547_Narrow-down-Reader-format-identification
Allow Reader format identification to use a subset of possible Readers
2022-04-19 14:44:31 +02:00
MarkBaker 4a65011a2f Allow Reader format identification to use a subset of possible Readers 2022-04-19 14:24:53 +02:00
Mark Baker c05fb6efa3
Merge pull request #2755 from PHPOffice/Ods-Writer-Freeze-Pane
Ods writer freeze pane
2022-04-18 20:24:11 +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
Mark Baker f426889571
Merge pull request #2754 from PHPOffice/Issue-2413_Autosize-Column-Allow-for-AutoFilter
Modify Autosize calculation to make allowance for the filter dropdown icon in the first row of an AutoFilter range
2022-04-17 22:07:13 +02: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
oleibman 9545b7a0d1
Fix Fluke Failure in Document Properties Test (#2738)
PR #2720 failed because a timestamp in Document Properties Test was off by 1. This was due to one of two possible reasons. The constructor for Properties set the Created and Modified times using separate calls to the time function; if those happened to occur in different seconds, the test would fail. The test might also fail if the Created and Modified times used the same timestamp, but the time used to compare against those was calculated in a different second. It is surprising that this failure hasn't shown up before. Regardless, this PR corrects both possible problems.
2022-04-17 08:44:29 -07:00
redforks d593617287
Fix font index problem (#2642)
* Fix font index problem

* Update RichTextSizeTest.php

Eliminate Phpstan failure.

* Update RichTextSizeTest.php

Eliminate now-unused import.
2022-04-17 08:27:28 -07:00
aswinkumar863 530e6642bf
Table name as an constructor argument
Replaced worksheet argument with table name
2022-04-17 17:48:38 +05:30
aswinkumar863 44d63f027a
Fixed coding standard with return typehints 2022-04-17 17:46:59 +05:30
aswinkumar863 ea3263650b
Minimum Table range validation
Range must be at least 1 column and 2 rows
2022-04-17 17:45:17 +05:30
aswinkumar863 3c4a51acb5
Minor refactoring work
testColumnInRange method renamed to isColumnInRange
2022-04-17 17:43:32 +05:30