Commit Graph

4694 Commits

Author SHA1 Message Date
oleibman 96f09441ca Merge branch 'master' into issue4081 2024-07-07 07:27:49 -07:00
oleibman 81964f991a Update CHANGELOG.md 2024-07-07 07:26:18 -07:00
oleibman 6d2d99a5b3 Merge pull request #4080 from oleibman/issue2581
Propagate Errors in Text Functions
2024-07-06 05:51:35 +00:00
oleibman 22bac3eb49 Merge branch 'master' into issue2581 2024-07-05 22:48:45 -07:00
oleibman 61b8aff359 Update CHANGELOG.md 2024-07-05 22:46:55 -07:00
oleibman 06737c1f96 Merge pull request #4073 from oleibman/issue1310
Change Style Without Affecting Current Cell/Sheet, and Invalid Formulas
2024-07-06 05:34:16 +00:00
oleibman 2a7cbaba1d Merge branch 'master' into issue1310 2024-07-05 22:22:01 -07:00
oleibman b8715a5d8a Update CHANGELOG.md 2024-07-05 22:20:57 -07:00
oleibman 8557ccb72a Ods Comments With Newlines
Fix #4081. Ods Reader was not reading entire contents of comment. On further inspection, Ods Writer also was not handling comments completely correctly. Ods comments are recorded as `text:p` children of `office:annotation` elements. A newline is inserted between successive `text:p` elements. The `text:p` element itself can have as descendants (at least):
- raw text
- `text:span` elements
- `text:line-break` elements, which also causes the insertion of a newline

Ods Writer is changed to use a single `text:p` with multiple span/linebreak elements. Ods Reader is changed to process in their entirety either that form, or multiple `text:p` elements. Styling of the individual elements of the comment is permitted in Ods. That has not been supported till now by PhpSpreadsheet, and this PR will not address that situation - Ods Reader hast little style support, and this would hardly be the most urgent case where it is missing.
2024-07-01 14:52:23 -07:00
oleibman 1b68270f80 Merge pull request #4085 from PHPOffice/dependabot/composer/phpstan/phpstan-1.11.5
Bump phpstan/phpstan from 1.11.3 to 1.11.5
2024-07-01 13:48:57 +00:00
oleibman ae8f2d7bd5 Update MemoryDrawing.php 2024-07-01 06:21:59 -07:00
dependabot[bot] a299be3a75 Bump phpstan/phpstan from 1.11.3 to 1.11.5
Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 1.11.3 to 1.11.5.
- [Release notes](https://github.com/phpstan/phpstan/releases)
- [Changelog](https://github.com/phpstan/phpstan/blob/1.11.x/CHANGELOG.md)
- [Commits](https://github.com/phpstan/phpstan/compare/1.11.3...1.11.5)

---
updated-dependencies:
- dependency-name: phpstan/phpstan
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-07-01 13:19:03 +00:00
oleibman cffcfb4a5c Merge pull request #4083 from PHPOffice/dependabot/composer/friendsofphp/php-cs-fixer-3.59.3
Bump friendsofphp/php-cs-fixer from 3.58.1 to 3.59.3
2024-07-01 13:13:12 +00:00
oleibman af96582219 Merge pull request #4084 from PHPOffice/dependabot/composer/mpdf/mpdf-8.2.4
Bump mpdf/mpdf from 8.2.3 to 8.2.4
2024-07-01 13:12:49 +00:00
oleibman 1f83ba8765 Merge pull request #4082 from PHPOffice/dependabot/composer/phpunit/phpunit-10.5.24
Bump phpunit/phpunit from 10.5.20 to 10.5.24
2024-07-01 13:12:19 +00:00
dependabot[bot] 381304db83 Bump mpdf/mpdf from 8.2.3 to 8.2.4
Bumps [mpdf/mpdf](https://github.com/mpdf/mpdf) from 8.2.3 to 8.2.4.
- [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.2.3...v8.2.4)

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

Signed-off-by: dependabot[bot] <support@github.com>
2024-07-01 11:53:07 +00:00
dependabot[bot] dd22bb5b7b Bump friendsofphp/php-cs-fixer from 3.58.1 to 3.59.3
Bumps [friendsofphp/php-cs-fixer](https://github.com/PHP-CS-Fixer/PHP-CS-Fixer) from 3.58.1 to 3.59.3.
- [Release notes](https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/releases)
- [Changelog](https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/master/CHANGELOG.md)
- [Commits](https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/compare/v3.58.1...v3.59.3)

---
updated-dependencies:
- dependency-name: friendsofphp/php-cs-fixer
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-07-01 11:53:04 +00:00
dependabot[bot] 7ce99c8834 Bump phpunit/phpunit from 10.5.20 to 10.5.24
Bumps [phpunit/phpunit](https://github.com/sebastianbergmann/phpunit) from 10.5.20 to 10.5.24.
- [Release notes](https://github.com/sebastianbergmann/phpunit/releases)
- [Changelog](https://github.com/sebastianbergmann/phpunit/blob/10.5.24/ChangeLog-10.5.md)
- [Commits](https://github.com/sebastianbergmann/phpunit/compare/10.5.20...10.5.24)

---
updated-dependencies:
- dependency-name: phpunit/phpunit
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-07-01 11:52:56 +00:00
oleibman 4860e8e4b8 Correct 2 Doc-block statements 2024-06-29 22:23:50 -07:00
oleibman 4b04cc1c8d Propagate Errors in Text Functions
Fix #2581 (not obvious - see next paragraph for explanation). This continues the work of PR #2902 (and also PR #3467) to have errors propagated through function calculations rather than treating them as strings. All text functions, and the concatenation operator, are addressed in this PR.

In the original issue, the spreadsheet being loaded uses the result of an unimplemented function as an argument to another function. When `getCalculatedValue` is used on the cell in question, the result is returned as `#VALUE!`. If the cell had just contained a function call to the unimplemented function, getCalculatedValue would have recognized the situation and returned oldCalculatedValue as the result. Not perfect, but good enough most of the time. User would like oldCalculatedValue returned here as well, which seems like a reasonable request.

PhpSpreadsheet always returns `#Not Yet Implemented` as the result for a function which it knows about but which is not yet implemented. That is the key to the `Cell` class being able to substitute oldCalculatedValue in the first place. However, in order to do that for the issue in question, that result has to be propagated to any functions for which the result is an argument. I don't want to add unimplemented to the list of known error codes, but I am willing to add a parameter to `ErrorValue::isError` to indicate whether that value should be considered an error (default is "no").

The first use of that new parameter would be by the text functions. They go through a common Helper routine, so it is pretty easily implemented. And, as it turns out, most of the text functions do not currently propagate errors, e.g. if A1 results in a value error, `=LEFT(A1,2)` will result in `#V` rather than `#VALUE!`. With this PR, they will now be handled correctly.
2024-06-29 22:00:39 -07:00
oleibman 14c3df0ebc Merge pull request #4076 from oleibman/pr1415
CSV Writer Allow Varying Number of Columns
2024-06-30 02:34:08 +00:00
oleibman e8bb091f3b Merge branch 'master' into pr1415 2024-06-29 19:32:02 -07:00
oleibman 1ef063381b Update CHANGELOG.md 2024-06-29 19:28:40 -07:00
oleibman aae4992dca Merge pull request #4074 from yfinkel/patch-1
Update JpGraphRendererBase.php - check existing of PlotLabel
2024-06-30 02:12:15 +00:00
Юрий Финкель 675efc1f79 getDataLabel() defends against empty labels 2024-06-28 11:01:58 +04:00
Юрий Финкель 3b37d3e300 getDataLabel() defends against empty labels 2024-06-28 10:58:03 +04:00
Юрий Финкель 766a73cf84 getDataLabel() defends against empty labels 2024-06-28 10:54:30 +04:00
Юрий Финкель f3693406ed getDataLabel defends against empty labels 2024-06-28 10:49:56 +04:00
Юрий Финкель ccee8690d1 getDataLabel defends against empty labels 2024-06-28 10:43:05 +04:00
oleibman 02479de01a CSV Writer Allow Varying Number of Columns
Supersedes PR #1415 by @AndrewMonty, which went stale in May 2020, and which is not directly usable due to changes between now and then. Fix #1414, which also went stale; I will remove the stale status and reopen the issue pending the merging of this PR.

Add an option to CSV Writer so that it writes the cells for a row only through the highest data column used in the row, rather than through the highest data column used in the worksheet.
2024-06-27 00:01:55 -07:00
Юрий Финкель 17fc6234e6 Update JpGraphRendererBase.php 2024-06-26 12:39:26 +04:00
Юрий Финкель 36f316856b Check existing of PlotLabel before using its method getDataValue()
I'v got that:

Uncaught PHP Exception Symfony\Component\ErrorHandler\Error\FatalError: "Error: Uncaught Error: Call to a member function getDataValue() on bool in .../vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Chart/Renderer/JpGraphRendererBase.php:337

I've found that it's necessary to check existing of PlotLabel before using its method getDataValue().
2024-06-26 10:59:17 +04:00
Юрий Финкель acd0e386e8 Update JpGraphRendererBase.php - check existing of PlotLabel
I've got
Uncaught PHP Exception Symfony\Component\ErrorHandler\Error\FatalError: "Error: Uncaught Error: Call to a member function getDataValue() on bool in .../vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Chart/Renderer/JpGraphRendererBase.php:337

I found that it's necessary to check existing of PlotLabel before using its method getDataValue().
2024-06-26 10:35:25 +04:00
oleibman 6d06bf94b0 Merge branch 'master' into issue1310 2024-06-25 23:18:38 -07:00
oleibman 352872048b Resolve Merge Conflicts 2024-06-25 23:16:10 -07:00
oleibman e40438916f Change Style Without Affecting Current Cell/Sheet, and Invalid Formulas
Fix #1310, which was closed as stale in 2020, but which I will now reopen. Supersedes PR #1311 (@jaiminmoslake7020), from which I will remove the stale label but leave closed. The issue and the PR were too limited  - they detected that the use of two equal signs at the start of a string made for an invalid formula, but there are variations, trivial and otherwise, which might also be detected. Using `setValue` with a string which starts with an equal sign will now attempt to parse (not evaluate) the formula; for certain situations in which the parser throws an exception, the string will be treated as a string rather than a formula. An example where it will still be treated as a formula is a 3D range reference, where the problem is not that it can't be parsed, but rather that the formula isn't supported (see unit test Calculation/Engine/RangeTest::test3dRangeEvaluation). Allowing such a formula might cause problems later on, but that is already what happens.

A string beginning with an equal sign but which isn't treated as a formula will automatically set the `quotePrefix` attribute to `true`; all other `setValue` attempts will set it to `false`. This avoids the problem of a lingering value causing problems later on.

It has long been a matter of discontent that setting a style can change the selected cells. A new method is added to `Worksheet`:
```php
applyStylesFromArray(string $coordinate, array $styleArray)
```
This will attempt to guarantee that the active sheet in the current spreadsheet, and the selected cells in the current worksheet, remain undisturbed after the call. The setting of `quotePrefix` above is the first use of the new method.
2024-06-25 22:06:36 -07:00
oleibman d767d4618a Merge pull request #4071 from oleibman/year1904
Make Base Date a Property of Spreadsheet
2024-06-26 05:00:26 +00:00
oleibman fe162bcf0e Update CHANGELOG.md 2024-06-25 21:58:10 -07:00
oleibman f181a4c66e Merge branch 'master' into year1904 2024-06-22 22:13:42 -07:00
oleibman 43589bc9b6 Make Base Date a Property of Spreadsheet
This change is extracted from PR #2787 by @MarkBaker. That change mostly deals with array functions, and that part will be superseded by PR #3962. However, this part of 2787 is not included in 3962.

Fix #1036 (closed as stale in 2019 and just reopened). Excel spreadsheets can have either of 2 base dates, 1900 or 1904, and the numeric value of any date cells will vary depending on which base date is in use. PhpSpreadsheet has, till now, handled that as a static property of Shared/Date. This does not work well if two spreadsheets with different base dates are open simultaneously. The code is changed to store the base date as a property of the spreadsheet when an Xls/Xlsx spreadsheet is loaded, and use that property when saving an Xls/Xlsx spreadsheet. Any call to `getCalculatedValue` or `getFormattedValue` will temporarily set the Shared/Date value to that of the spreadsheet, and restore it at completion. In order to avoid a BC break, the Xls and Xlsx readers will continue to populate the Shared/Date value as before.
2024-06-22 22:09:22 -07:00
oleibman cabd60ca09 Merge pull request #4060 from oleibman/stan9d
Better Definitions for Mixed Parameters and Values Part 3 of Many
2024-06-23 04:31:16 +00:00
oleibman 275b9480a3 Merge pull request #4069 from mogic-le/yield-docs
Documentation and example for rangeToArrayYieldRows()
2024-06-17 18:21:07 +00:00
Christian Weiske 1c931e2870 Documentation and example for rangeToArrayYieldRows()
Related: https://github.com/PHPOffice/PhpSpreadsheet/pull/3906
2024-06-17 11:29:36 +02:00
oleibman 60baa3a1b6 Merge pull request #4065 from oleibman/issue4004td
More RTL Support for Xlsx/Html Comments
2024-06-11 13:27:54 +00:00
oleibman 5c3b63068e Merge branch 'master' into issue4004td 2024-06-11 06:25:38 -07:00
oleibman a3c6f8f5c6 Update CHANGELOG.md 2024-06-11 06:24:33 -07:00
oleibman b57a549fab More RTL Support for Xlsx/Html Comments
Following up from PR #4006. There is an additional RTL property available. It controls the placement of bidirectional neutral characters (mainly punctuation), as opposed to strong (alphabetic characters) or weak (numeric characters), especially at the beginning or end of a line. The new Comment property textboxDirection will be used for that purpose.

In a discussion in issue #4004 following the implementation of the PR, the comment was mixed RTL and LTR, and this led to some formatting problems. The user was able to overcome these with the timely insertion of Unicode directional control characters, but it would be preferable to have it happen automatically, which this change will permit. However, the use of these control characters cannot be entirely done away with. In the new test case, if one of the all-English lines ended with, say, a colon, it would not display correctly; LRM (left-to-right mark) after the colon would be needed. Likewise, one or two of the comment lines with mixed RTL and LTR (discussed in the issue) is not formatted correctly, and might require LRO/PDF or equivalent.
2024-06-06 16:55:27 -07:00
oleibman 1c06890c7f Merge pull request #4064 from oleibman/issue4063
Handle Empty String in SharedStrings
2024-06-06 13:41:05 +00:00
oleibman 7c1ff62ed4 Update CHANGELOG.md 2024-06-06 06:38:50 -07:00
oleibman 5e26de63a9 Handle Empty String in SharedStrings
Fix #4063. Fix #1560. Fix #1293. PhpSpreadsheet is not accounting for an empty string in Xlsx sharedStrings.xml.The code which parses it in Reader/Xlsx looks for a `t` or `r` tag descending from `si`, but, in this case, the tag is coded as `<si/>`, with neither t nor r tag descending. An else clause is added to set the string to empty string in this case.

I was surprised that this had not turned up before, and a search through the archives found at least 2 earlier reports from 4 years ago. Those had been marked stale; the stale indicator is removed, and the issues are re-opened, to be closed when this PR is merged.
2024-06-06 06:17:02 -07:00