Commit Graph

3678 Commits

Author SHA1 Message Date
MarkBaker 42cf5ce6a4 Re-baseline phpstan 2022-08-18 12:31:08 +02:00
MarkBaker d06d1cca39 Merge remote-tracking branch 'origin/2.0-Development' into 2.0-Development 2022-08-18 06:59:51 +02:00
Mark Baker 125f5b1e7f Merge pull request #3012 from PHPOffice/2.0-CalcEngine-Function-Renames
2.0 calc engine function renames
2022-08-18 06:56:15 +02:00
MarkBaker 0665a87f20 Re-baseline phpstan 2022-08-18 06:46:49 +02:00
MarkBaker a7ac633134 Adjustment to error check in TEXTFROMARRAY() function 2022-08-17 21:28:58 +02:00
MarkBaker a26a58dbd2 Merge branch 'master' into 2.0-Development
# Conflicts:
#	phpstan-baseline.neon
#	src/PhpSpreadsheet/Cell/Cell.php
2022-08-17 18:44:24 +02:00
Mark Baker a0022884e3 Merge pull request #2937 from PHPOffice/2.x-Calendar-Changes
2.x calendar changes
2022-08-17 18:39:53 +02:00
MarkBaker aba94a1921 Fix merge from 2.0 for the Spreadsheet Copy (I really don't like this approach, it shouldn't be necessary to save to a temporary file and then restore, a deep clone should be the correct approach) 2022-08-17 17:57:06 +02:00
Mark Baker 6cdfd3c6d6 Merge branch '2.0-Development' into 2.x-Calendar-Changes 2022-08-17 16:48:45 +02:00
MarkBaker 765037e31d Ensure that correct calendar (read from the spreadsheet when loaded) is used for all date-related calculations and formatting 2022-08-17 16:41:14 +02:00
MarkBaker d7da206103 Remove file accidentally committed 2022-08-15 07:47:27 +02:00
Mark Baker 4f714cd2a3 Merge pull request #3007 from PHPOffice/Issue-3005_Extract-CellReferences-in-Range-with-Worksheet-Reference
Adjust `extractAllCellReferencesInRange()` method to allow a worksheet in the reference
2022-08-15 06:40:50 +02:00
MarkBaker b0f7e83dc2 Fix phpstan baseline 2022-08-15 06:33:31 +02:00
Mark Baker 44ab25d4f2 Merge branch 'master' into Issue-3005_Extract-CellReferences-in-Range-with-Worksheet-Reference 2022-08-15 06:21:06 +02:00
Mark Baker 069efdb729 Merge pull request #3008 from PHPOffice/Expand-Return-Datatypes
More return type declarations, and some additional argument typehinting
2022-08-15 06:20:51 +02:00
Mark Baker dfa6f803fd Merge branch 'master' into Issue-3005_Extract-CellReferences-in-Range-with-Worksheet-Reference 2022-08-15 00:25:03 +02:00
Mark Baker febd8d8991 Merge branch 'master' into Expand-Return-Datatypes 2022-08-15 00:24:49 +02:00
MarkBaker cd66298901 Adjust extractAllCellReferencesInRange() method to allow a worksheet in the reference 2022-08-14 23:43:52 +02:00
oleibman bb072d1ca7 Upgrade Dev TCPDF to 6.5 (#3006)
* Upgrade Dev TCPDF to 6.5

Implementation of https://github.com/tecnickcom/TCPDF/pull/467, which is available in just-released Tcpdf 6.5, will improve look of Tcpdf rendering for PhpSpreadsheet. Fix #1164.

One test had been suppressed for Tcpdf, ostensibly because it was not compatible with Php8. As it turns out, the PhpSpreadsheet code which invokes Tcpdf was (harmlessly) incorrect, so the Php8 issue was actually with PhpSpreadsheet, not Tcpdf. That code is corrected, and the test is no longer suppressed.

* Update Change Log

Pick up some earlier changes as well as this one, and deprecations which had been omitted from the 1.24 change log.
2022-08-14 10:57:34 -07:00
oleibman fadfb727bf Minor Changes for Mpdf, Dompdf (#3002)
See discussion in #2999. Mpdf is not acknowledging the styling that we're using to hide table rows. I have opened an issue with them, but enclosing the cells in the hidden row inside a div with appropriate css does seem to be a workaround, and that can be incorporated into PhpSpreadsheet. It's kludgey, and it isn't even valid HTML, but ...

Mpdf also doesn't like the addition of the ```file:///``` prefix when using local images from Windows (sample 21). Results are better when that prefix is not added.

Dompdf seemed to have problems with sample 21 images on both Windows and Unix, with or without the file prefix. It does, however, support data urls for both, so is changed to embed images. It's still not perfect - the image seems truncated to the row height - but the results are better. I will continue to research, but may proceed as-is if I don't find anything better to do.

Html Writer was producing a file with mixed line endings on Windows. This didn't cause any harm, but it seems a bit sloppy. It is changed to always use PHP_EOL as a line ending.
2022-08-13 18:28:22 -07:00
oleibman 5c13b179a1 Replace Dev jpgraph/jpgraph with mitoteam/jpgraph (#2997)
* Replace Dev jpgraph/jpgraph with mitoteam/jpgraph

PR #2979 added support for mitoteam/jpgraph as an alternative to jpgraph/jpgraph. The package jpgraph/jpgraph is abandoned in composer, and the version loaded with composer has been unusable for some time. This PR removes the dev requirement for jpgraph/jpgraph, and adds a dev requirement for mitoteam/jpgraph in its place.

With a usable graph library, a number of tests and samples that had been disabled are now re-enabled. A lot of new functionality has been added to Charts recently. Some of that new code has exposed bugs in JpgraphRendererBase. I have fixed those where I could. A handful of exceptions remain; I will investigate, and hopefully fix, those over time, but I don't feel it is necessary to fix them all before installing this PR - we are already way ahead of the game with the graphs that are working.

Three members had been ignoring code coverage in whole or in part because of the unavailability of a usable graph libray. Code coverage is restored in them. I am relieved to report that, although they aren't completely covered, adding them did not reduce code coverage by much - it is still over 90.4%.

I took a look at JpgraphRendererBase and Phpstan. Phpstan reports 128 problems. When I added some docblocks to correct some of those, the number increased to 284. Sigh. I will investigate over time, but, for now, we will still suppress Phpstan for JpgraphRendererBase.

I do not find a License file for mitoteam. However, there also wasn't one for jpgraph in the first place. Based on that and the discussion in #2996 (mitoteam will be used in exactly the same manner as mpdf), I don't think this is a problem. IANAL.

* PHP 8.2 Problems

Tons of "cannot create dynamic property" deprecations in jpgraph. Disable the test with most of those for now; leave the two with only a handful of messages enabled.

* Correct Failures in 2 Stock Charts

Down to 6 templates on which Render fails.
2022-08-13 18:14:25 -07:00
oleibman f34e0ead29 Add setName Method for Chart (#3001)
Addresses a problem identified in issue #2991. Chart name is set in constructor, but there is no method to subsequently change it. This PR adds a method to do so.
2022-08-12 20:10:45 -07:00
oleibman 0492ea6d8a Use Only mb_convert_encoding in StringHelper sanitizeUTF8 (#2994)
* Test if UConverter Exists Without Autoload

Fix #2982. That issue is actually closed, but it did expose a problem. Our test environments all enable php-intl, but that extension isn't a formal requirement for PhpSpreadsheet. Perhaps it ought to be. Nevertheless ...

Using UConverter for string translation solved some problems for us. However, it is only available when php-intl is enabled. The code tests if it exists before using it, so no big deal ... except it seems likely that the people reporting the issue not only did not have php-intl, but they do have their own autoloader which issues an exception when the class isn't found. The test for existence of UConverter defaulted to attempting to autoload it if not found. So, on a system without php-intl but with a custom autoloader, there is a problem. Code is changed to suppress autoload when testing UConverter existence.

Pending this fix, the workaround for this issue is to enable php-intl.

* Minor Improvement

Make mb_convert_encoding use same substitution character as UConverter, ensuring consistent results whatever the user's environment.

* And Now That I Figured That Out

Since mb_convert_encoding can now return the same output as UConverter, we don't need UConverter (or iconv) after all in sanitizeUTF8.
2022-08-12 18:59:28 -07:00
MarkBaker b783fecb7f More return type declarations, and some additional argument typehinting 2022-08-12 14:03:13 +02:00
MarkBaker 3964087779 Test for calendar when reading Excel Files.
Set Excel calendar to be used for calculations and formatting for the calendar stored against the spreadsheet.
2022-08-08 15:17:27 +02:00
Mark Baker d13b07ba6e Merge pull request #2995 from PHPOffice/Matrix-Operations-Additional
Additional for PR #2964; validate value after extracting from flattened array
2022-08-07 19:15:57 +02:00
MarkBaker ca1650df9e Additional for [PR #2964](https://github.com/PHPOffice/PhpSpreadsheet/pull/2964); validate value after extracting from flattened array 2022-08-07 18:45:36 +02:00
Mark Baker c34662b8b2 Merge pull request #2993 from PHPOffice/Matrix-Arithmetic-Value-Testing
Expand PR #2964 to cover all arithmetic operators, and both left and right side values
2022-08-07 14:18:58 +02:00
Mark Baker b627770ece Merge branch 'master' into Matrix-Arithmetic-Value-Testing 2022-08-07 14:07:31 +02:00
MarkBaker 71b2c5ae89 Expand [PR #2964](https://github.com/PHPOffice/PhpSpreadsheet/pull/2964) to cover all arithmetic operators, not just multiplication, and both left and right side values 2022-08-07 13:59:26 +02:00
Mikhail Oleynik b65ff9f20d MtJpGraph support added (#2979)
https://github.com/PHPOffice/PhpSpreadsheet/pull/2979

Co-authored-by: Mikhail Oleynik <mishutka@mito-team.com>
2022-08-07 04:50:38 -07:00
oleibman 8bde1ace44 Charts Support for Rounded Corners and Trendlines (#2976)
Fix #2968. Fix #2815. Solution largely based on suggestions by @bridgeplayr.
2022-08-06 18:06:36 -07:00
oleibman eb76c3c0ff Code Coverage >90% (#2973)
No source code changes, just additional tests. FormulaParser appears unused, replaced by newer code in Calculation. However, it's a public interface, so probably shouldn't be deleted without first deprecating it. I have no strong feelings about whether that should happen. However, as long as it's part of the package, we may as well have some formal unit tests for it.
2022-08-06 17:56:30 -07:00
oleibman b661d31887 Limited Support for Chart Titles as Formulas (#2971)
This is a start in addressing issue #2965 (and earlier issue #749). Chart Titles are usually entered as strings or Rich Text strings, and PhpSpreadsheet supports that. They can also be entered as formulas (typically a pointer to a cell with the title text), and, not only did PhpSpreadsheet not support that, it threw an exception when reading a spreadsheet that did so.

This change does:
- eliminate the exception
- set a static chart title when it can determine it from the Xml

This change does not:
- fully support dynamic titles (e.g. if you change the contents of the source cell, or delete or insert cells or rows or columns)
- permit the user to set the title to a formula
- allow the use of formulas when writing a chart title to a spreadsheet
- provide styling for titles when it has read them as a formula
2022-08-06 17:39:18 -07:00
Jonathan Goode 7f0ca404fc Ensure multiplication is performed on a non-array value (#2964)
* Ensure multiplication is performed on a non-array value

* Simplify formula
Numbers should be numbers

* Provide test coverage for SUM combined with INDEX/MATCH

* PHPStan
2022-08-06 17:28:26 -07:00
MarkBaker b30f364a1c Renaming methods for Excel functions to provide more consistent case, and meaningful names 2022-08-05 12:31:10 +02:00
Mark Baker ada583f3cf Merge pull request #2990 from PHPOffice/TextFunctions-ArrayToText
Initial work on the ARRAYTOTEXT() Excel Function
2022-08-05 01:17:07 +02:00
Mark Baker a8b6214574 Merge branch 'master' into TextFunctions-ArrayToText 2022-08-04 23:02:20 +02:00
MarkBaker 4724c8f7e9 Initial work on the ARRAYTOTEXT() Excel Function 2022-08-04 22:43:36 +02:00
Mark Baker 630d92f0f4 Merge pull request #2988 from PHPOffice/Issue-2987_NamedCell-UTF8-Worksheet-getCell
cellExists() and getCell() methods should support UTF-8 named cells
2022-08-04 15:00:40 +02:00
MarkBaker f331bca470 cellExists() and getCell() methods should support UTF-8 named cells 2022-08-04 14:38:35 +02:00
MarkBaker 76314ddbc8 merge from master and re-baseline phpstan 2022-08-03 14:28:19 +02:00
MarkBaker fe4808b3d5 Merge branch 'master' into 2.0-Development
# Conflicts:
#	composer.lock
#	tests/PhpSpreadsheetTests/Calculation/Functions/LookupRef/VLookupTest.php
2022-08-03 14:03:43 +02:00
MarkBaker 06d2682c5b Documentation markdown fix 2022-08-03 12:43:38 +02:00
Mark Baker a7df02fd55 Merge pull request #2975 from PHPOffice/TextFunctions-New-TextSplit
Initial implementation of the `TEXTSPLIT()` Excel Function
2022-08-03 12:38:16 +02:00
Mark Baker fe3ec55341 Merge branch 'master' into TextFunctions-New-TextSplit 2022-08-02 19:36:47 +02:00
MarkBaker 07f4fbe396 Initial implementation of the TEXTSPLIT() Excel Function 2022-08-02 19:05:43 +02:00
dependabot[bot] db2bc3b289 Bump phpstan/phpstan from 1.8.0 to 1.8.2 (#2977)
Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 1.8.0 to 1.8.2.
- [Release notes](https://github.com/phpstan/phpstan/releases)
- [Changelog](https://github.com/phpstan/phpstan/blob/1.8.x/CHANGELOG.md)
- [Commits](https://github.com/phpstan/phpstan/compare/1.8.0...1.8.2)

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

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-08-01 06:03:17 -07:00
Mark Baker 1c587e90c6 Merge pull request #2972 from PHPOffice/TextFunctions-New
Allow multiple delimiters for `TEXTBEFORE()` and `TEXTAFTER()` functions
2022-07-30 10:57:52 +02:00
MarkBaker 290d0731fe Allow multiple delimiters for TEXTBEFORE() and TEXTAFTER() functions 2022-07-30 10:27:31 +02:00