Commit Graph

4055 Commits

Author SHA1 Message Date
Mark Baker e34121e195 Merge branch 'master' into CalcEngine_Extend-Exception-Returning 2023-03-26 16:25:29 +02:00
oleibman 0e6866d6f0 Font/Effects/Theme Support for Chart Data Labels and Axis (#3476)
* Font and Effects Support for Chart Data Labels and Axis

Addresses some remaining issues with 32readwriteLineChart5 (see issue #1797). Font size is covered. So are effects, although the results are a bit odd. For the new spreadsheet 32readwriteLineChart6, the Axis labels have a yellow-ish glow, but reading and writing the spreadsheet in PhpSpreadsheet gives them a purple-ish glow. Nevertheless, the new test shows that the output file uses schemeClr accent4, as does the input file. So the effect is handled correctly, but it seems there is likely to be a difference between theme colors (Writer/Xlsx/Theme appears to write hard-coded color schemes, and, in any case, Reader/Xlsx does not appear to handle schemeClr). Fixing that will be a great deal more difficult, with a large chance of regression, and will need to happen in a separate PR (one that I am not currently investigating, but I will open a new issue). Effects using srgbClr (and probably sysclr) should be okay.

* Better Theme Support

When reading Xlsx, the theme colors will now also be used for writing. This means that a file can be loaded and saved and its chart colors will now be preserved. If the spreadsheet is created new, Excel 2007-2010 colors are used. The writer is currently hard-coded to use them, so this avoids making this a breaking change. The theme colors can be explicitly changed if desired, and Excel 2013+ colors can be introduced very easily.
```php
$spreadsheet->getTheme()
    ->setThemeColorName(Theme::COLOR_SCHEME_2013_PLUS_NAME);
```
Likewise, if the old behavior of changing to the 2007-2010 scheme rather than using the input values is desired, that is easy to achieve after the load has taken place.
```php
$spreadsheet->getTheme()
    ->setThemeColorName(Theme::COLOR_SCHEME_2007_2010_NAME);
```
The new Theme class introduced by this change can easily be extended to include Fonts and Effects. Unlike Colors, I am unsure what the practical effects of changing those to, say, the 2013+ defaults would be.

* Scrutinizer

Use an alias in a use statement.

* Update Change Log

Due to potential behavior change.
2023-03-26 03:19:34 -07:00
MarkBaker 62d1301890 Minor adjunct to mpdude's PR to return the previous exception 2023-03-26 09:01:27 +02:00
Esteban Gehring 27a1c598da update instructions for migration from phpexcel (#3483) 2023-03-25 07:31:59 -07:00
oleibman cd9f1659fe WIP Handle REF Error as Part of Range (#3467)
Fix #3453. User sets a valid formula (e.g. `=SUM(Sheet2!B1:Sheet2!B3)`), and then does something to invalidate the formula (e.g. delete Sheet2). Excel changes the formula to `SUM(#REF!:#REF!)` when the spreadsheet is saved; apparently someone thought this was a good idea. But PhpSpreadsheet (a) used to throw an Exception when it evaluated the formula, and (b) now gives a result of `0` when evaluating the formula. Neither is ideal. It would be better to propagate the `#REF!` error.

It is likely that more tests are needed, which is why I will keep this in draft status for a bit.
2023-03-25 07:03:52 -07:00
Mark Baker 1f32fa489a Merge pull request #3329 from mpdude/patch-1
Include previous exception in \PhpOffice\PhpSpreadsheet\Cell\Cell::getCalculatedValue()
2023-03-25 09:09:24 +01:00
Mark Baker f95e56b609 Merge branch 'master' into patch-1 2023-03-25 08:42:11 +01:00
Mark Baker a9e302449a Merge pull request #3479 from PHPOffice/NumberFormat-Wizard-Duration
Duration NumberFormat Wizard
2023-03-25 02:42:56 +01:00
Mark Baker 0016de81a4 Merge branch 'master' into NumberFormat-Wizard-Duration 2023-03-25 02:39:35 +01:00
Mark Baker a7ac5a7d00 Merge pull request #3481 from PHPOffice/NumberFormat-Wizard-DateTime-Defaults
Add defaults for Date and Time NumberFormat Wizards
2023-03-24 02:41:40 +01:00
MarkBaker 6f60191b61 Add defaults for Date and Time NumberFormat Wizards 2023-03-23 21:53:30 +01:00
MarkBaker 0c0fa705db Duration NumberFormat Wizard 2023-03-23 16:29:24 +01:00
MarkBaker 58ac4ca288 Update to Change Log 2023-03-22 13:38:00 +01:00
MarkBaker 8888c58eaa Inline documentation updates 2023-03-22 13:02:18 +01:00
Mark Baker c034e3cf15 Merge pull request #3474 from PHPOffice/Issue-3473_Shared-Formula-Chunked-Read-no-attribute-set
Shared Formulae outside the filter range when reading with a filter are not always being identified
2023-03-22 03:01:00 +01:00
Mark Baker 00ece21e40 Merge branch 'master' into Issue-3473_Shared-Formula-Chunked-Read-no-attribute-set 2023-03-22 02:42:43 +01:00
MarkBaker c77360fe47 ChangeLog 2023-03-22 02:25:45 +01:00
MarkBaker 582997dbad Scouting improvement: move the Shared Formula data to an object in an instance array, rather than using a simple nested array. This should be better for memory usage; and when we can apply readonly to object properties, then we can make the properties readonly public, eliminate the getters in the SharedFormula class 2023-03-22 02:21:02 +01:00
oleibman 514fcff904 Catch Up Change Log (#3475)
Some changes missing since release 28.
2023-03-21 17:25:47 -07:00
MarkBaker bc8feec62a When loading a file and accessing cells outside a filter range, we still check for shared formulae that may need to be used inside the filter range; so we test for the cell's f attribute.
However, in some cases this attribute isn't set and we need to check for the presence of an f child element with a shared attribute
2023-03-21 22:50:44 +01:00
oleibman dafd78b462 Support Border for Charts (#3462)
* Support Border for Charts

All chart linestyles will be supported for Chart Border. Also add fill color for Chart. Also 'nofill' for Axis (allows suppressing of vertical axis line). These are demonstrated in sample 32_readwriteChartLine5, and a new unit test member is added. This addresses some vague problems added to issue #1797 over 8 months after it was closed; there is still at least one problem, much more complicated than the 2 being addressed in this PR.

* Handle Legend Borders in Same Way as Chart Borders

Consistency is good, and the implementation of Chart Borders offers more possibilities than the implementation of Legend Borders had. Since Legend Borders hasn't made it to a release yet, there is no need for deprecations.
2023-03-19 18:32:33 -07:00
Mark Baker 025e905b97 Merge pull request #3469 from PHPOffice/Issue-3439_GetStyle-with-CellAddress-object-including-Worksheet
Fix for Issue 3439 - Getting a style for a CellAddress instance fails…
2023-03-20 00:57:18 +01:00
MarkBaker a085835eb5 Fix for Issue 3439 - Getting a style for a CellAddress instance fails if the worksheet is set in the CellAddress instance 2023-03-19 17:33:00 +01:00
Mark Baker e4a770eae9 Merge pull request #3468 from PHPOffice/NumberFormat-DateTime-Update-Documentation
Include an example of Date/Time NumberFormat Wizards in the documentation
2023-03-19 14:09:16 +01:00
MarkBaker 3240d022d5 Include an example of Date/Time NumberFormat Wizards in the documentation 2023-03-19 06:25:53 +01:00
oleibman 011f9cd1a4 Xlsx Writer Honor Alignment in Default Font (#3459)
* Xlsx Writer Honor Alignment in Default Font

Fix #3443. A mysterious implementation by Excel. The style tags have an attribute applyAlignment, which nominally says whether or not the style should use its own Alignment. Except ... Excel ignores that attribute and uses the alignment tag if it is supplied ... and, another mystery, uses not the default style for the spreadsheet if not supplied, but rather uses the default alignment style for all spreadsheets even if the spreadsheet's default style uses a non-default alignment. I am changing Xlsx Writer to generate alignment tag unless the alignment matches both the default alignment for the spreadsheet and the default alignment for all spreadsheets (which I expect to happen most of the time).

* Improve Performance

Also don't change horizontal/vertical on Xlsx Read if they aren't explicitly set.
2023-03-18 11:50:12 -07:00
Mark Baker 076ef9d542 Merge pull request #3466 from PHPOffice/NumberFormat-Wizards_Non-breaking-space
Use NBSP in Accounting WIzard, and as an option for Date/Time Wizards
2023-03-18 19:11:54 +01:00
Mark Baker c3ac0cff71 Merge branch 'master' into NumberFormat-Wizards_Non-breaking-space 2023-03-18 17:25:56 +01:00
MarkBaker b906d10111 Use NBSP in Accounting Wizard, and as an option for Date/Time Wizards 2023-03-18 17:05:40 +01:00
anhoder b4e4e2085b Fix incorrect font color read from xlsx (#3465)
Place the read font color after setting the styles
2023-03-18 09:04:31 -07:00
Pouria Seyfi 603d093df7 Specify data type in html tags using attributes (#3445)
* Specify data type in html tags using attributes #3444

* Set data types using attributes in flushCell function and add some unit tests

* Check TYPE_INLINE in flushCell and some changes in test cases
2023-03-18 08:37:39 -07:00
MarkBaker 452ec07e42 Update to Read Me 2023-03-17 13:46:00 +01:00
MarkBaker 88dba59f20 Update to Readd Me 2023-03-17 13:39:24 +01:00
Mark Baker 1192d3cbae Merge pull request #3458 from PHPOffice/NumberFormat-Wizards-Date-Time-Duration
Initial work on Date, Time and DateTime NumberFormat Wizards
2023-03-17 13:29:59 +01:00
Mark Baker cea9c4dce7 Merge branch 'master' into NumberFormat-Wizards-Date-Time-Duration 2023-03-17 13:26:47 +01:00
Mark Baker 66b95be770 Merge pull request #3463 from PHPOffice/Issue-3461_Xlsx-Writer-FunctionPrefix-Regexp
Establish boundary for function prefix regexp to prevent over-aggressive prefixing
2023-03-17 08:36:12 +01:00
MarkBaker e58d51fdb9 Issue 3461 - Establish boundary for function prefix regexp to prevent NETWORKDAYS being picked up by DAYS 2023-03-17 08:13:22 +01:00
MarkBaker ec60f5896b Escape single characters in Date, Time and DateTime NumberFormat Wizards 2023-03-16 13:06:03 +01:00
MarkBaker 7a0c18f3e7 Refinements to Date, Time and DateTime NumberFormat Wizards 2023-03-16 10:53:01 +01:00
MarkBaker ca05f69b4a Initial work on Date, Time and DateTime NumberFormat Wizards 2023-03-16 02:25:10 +01:00
Mark Baker 99a7de3812 Merge pull request #3448 from PHPOffice/UnitTests_Refactoring-Database-and-DateTime
Refactor unit tests to ensure that assertions and setup/teardown are in the actual test for ease of review
2023-03-14 11:40:57 +01:00
Mark Baker c196625cb1 Merge branch 'master' into UnitTests_Refactoring-Database-and-DateTime 2023-03-14 11:15:49 +01:00
MarkBaker fe31c2004f Extended unit tests for Engineering functions 2023-03-14 06:53:45 +01:00
MarkBaker 36e9e864e6 Additional edge-case tests 2023-03-14 06:53:45 +01:00
oleibman 4b7aa20b24 Run phpcs, php-cs-fixer, phpstan, coverage, versions as Php8.1 (#3450)
* WIP Run phpcs, php-cs-fixer, phpstan, coverage, versions as Php8.1

They all run under Php7.4 in Github. 7.4 is EOL. We still have to run unit tests in 7.4, but I think it's time to move the tools. Note that we cannot currently run Phpstan in 8.2 because of https://github.com/phpstan/phpstan/issues/8629.

* Update main.yml

Try running coverage as 8.0 rather than 8.1.

* Update main.yml

Revert Coverage to Php 7.4.

* Composer Cache Directory

Command set-output is deprecated. Upgrading to using Environment files as suggested by Github messages.

* Coverage and Php8

Try to follow advice in https://github.com/scrutinizer-ci/ocular/issues/54

* Keep Trying

See https://github.com/phpowermove/docblock/pull/12/files
2023-03-13 18:13:57 -07:00
oleibman ff625d784d More Coverage In Unit Tests (#3447)
* More Coverage In Unit Tests

Minimal source code changes.

* Scrutinizer

One legitimate complaint and one from out of left field.

* Scrutinizer Lunacy

If this doesn't stop its complaint, I give up.

* Scrutinizer - Whatever

Try again.

* Glutton For Punishment

Try again.
2023-03-13 05:25:42 -07:00
Mark Baker 0875326fa8 Merge pull request #3452 from PHPOffice/Minor-Bugfix_Apply-strict-validation-to-Complex-suffix
Apply strict type checking to Complex suffix
2023-03-12 16:00:38 +01:00
MarkBaker 6836c84888 Apply strict type checking to Complex suffix 2023-03-12 13:12:05 +01:00
oleibman a3489b5d89 Minor Changes to 3 Tests/Samples (#3451)
No source changes. Act on some items that have come up in recent discussions.
- Sample 33_Chart_create_line creates a stacked line chart. According to @MarkBaker, the stacking is done on the wrong variable, and, even were that not the case, stacking is unusual for line charts. Since this is our primary sample showing how to create a line chart, remove the stacking. Another sample, with a more appropriate choice of chart (33_Chart_create_bar_stacked), still shows how to create a stacked chart.
- The test for reading a styled cell from Html is flawed. It sets a date format for a string date/time, but the format is applied only to numeric data, so the format, although set correctly, is ineffective. Keep the test, but add some explanation in the assertion, and add some new more effective tests, also with explanations in the assertions.
- Wrong namespace used for Writer/Xlsx/ConditionalFillTest.
2023-03-12 00:22:20 -08:00
MarkBaker 9c2deb125f Scrutinizer really sucks!!!
Stop a few of scrutinizers complaints about 100% valid use of PHP variadics.
Hopefully, this issue will cease to be an issue when we can specify mixed datatype for variadic arguments in the tests
2023-03-10 04:43:11 +01:00