Commit Graph

4025 Commits

Author SHA1 Message Date
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
MarkBaker a91dd60a98 Refactor unit tests to ensure that assertions are in the actual test, and not in an abstract class; and that setup/teardown are in the test and not an abstract. This means that assertions and setup/teardown are always in the file when reviewing PRs.
Also enforce more rigorous Excel Function implementation by testing the underlying implementation, call via the Calc Engine, and execution from in a worksheet.
Separate out unhappy path (exception) checks into a separate test, so that a single test isn't made overcomplex checking for every potentiality.

Scrutinizer may dislike variadics, for variable number of arguments of mixed type; but tough. It's 100% valid PHP, accepted by phpstan, and makes life a lot easier.

Initial work here covers all the database and datetime unit tests for Excel function implementations.
2023-03-10 04:15:12 +01:00
oleibman 20348642ed More Display Options for Chart Axis and Legend (#3434)
* Allow Color and Effects on Data Points on Chart Axis

Fix #3414. There had been no way to do this. It is now supported via a new AxisText class, which derives from Properties, and has FillColor and effects (glow/shadow/softEdges) properties. The code changes in chart sample 33_Chart_create_scatter2 illustrate usage.

* Minor Performance Improvement

May also get rid of Scrutinizer complaint.

* Eliminate New Spacing Patch

No need for it.

* Add Legend Formatting to Change

Much in common with Data Point formatting.
2023-03-09 10:15:24 -08:00
Mark Baker 64f32d8c75 Merge pull request #3441 from PHPOffice/Documentation-Updates
Update recipe docs for Spreadsheet Properties.
2023-03-09 17:52:08 +01:00
MarkBaker d73d063556 Update contributor notes and related composer scripts 2023-03-09 17:38:20 +01:00
MarkBaker 202964ee26 Minor update to documentation index 2023-03-09 17:37:50 +01:00
MarkBaker 15044fd20d Formats for custom date properties 2023-03-09 01:47:06 +01:00
MarkBaker 68873e632d Update recipe docs for Worksheets 101, and setting the Active Worksheet. 2023-03-08 21:23:54 +01:00
MarkBaker b5b64ebe6e Update recipe docs for Spreadsheet Properties. 2023-03-08 20:07:07 +01:00
oleibman 73f880ff19 Correct Xlsx Parsing of quotePrefix="0" (#3438)
* Correct Xlsx Parsing of quotePrefix="0"

Fix #3435. Mis-parsed attribute is not normally generated by Excel or PhpSpreadsheet, but some 3rd-party software (correctly) generates it.

* Update Issue3435Test.php
2023-03-07 07:51:20 -08:00
Mark Baker cba1f07235 Merge pull request #3437 from PHPOffice/Issue-3436_EDATE-EOMONTH-Rounding-to-Date
Fix for Issue #3436 - Result from Excel's EDATE() and EOMONTH() should always be rounded to 0 decimal
2023-03-06 17:40:55 +01:00
MarkBaker 9006d2a3f4 Fix for Issue #3436 - Result from Excel's EDATE() and EOMONTH() should always be rounded to 0 decimal 2023-03-06 17:22:30 +01:00
oleibman bb54c89cde Xlsx Column Autosize Approximate for CJK (#3416)
Fix #3405. Autosize is definitely not working well with CJK characters (column is not wide enough). User reports a workaround using `mb_strwidth` to calculate and set the column width. PhpSpreadsheet uses `mb_strlen` for width calculations. Change it to use mb_strwidth instead. For non-CJK strings, the results will be identical (and there are already unit tests on such strings which assert the expected results, and these tests did not need to change). For CJK strings, the results will be wider. The string I'm using to test comes from the issue. It currently results in a column width of 30.564. When I open the resulting sheet in Excel and auto-fit the column width, the width winds up as 43.00. So, as long as the computed width exceeds 43.00, the spreadsheet will show the full cell. With the new calculation, the computed width is 55.2722, satisfying our condition. This is wider than expected, but that is generally true for this type of computation. For example, for 'abcdefghijklmnopqrstuvwxyz', the computed width (before and after this change) is 31.7065, but Excel auto-fit actually uses 24.73.

Disappointingly, "exact width calculation" does not solve this problem. It does seem to do a little better than "approximate" for non-CJK, but its CJK calculation is not wide enough. This might or might not indicate a bug in Php function `imagegetttfbbox`; I do not know enough about it to report a bug. Anyhow, since we're dependent on that result, there is no equivalent in this case for swapping mb_strlen out for mb_strwidth.
2023-03-04 07:37:52 -08:00
Mark Baker 0610e57c48 Merge pull request #3429 from PHPOffice/RichText_Update-Recipe-in-docs
Update to Docs for RichText
2023-03-02 16:15:05 +01:00
MarkBaker aa374fde4c Update to Docs for RichText 2023-03-02 16:09:59 +01:00
oleibman 66221bfcb2 TEXT Function Ignores Time in DateTimeStamp (#3411)
Fix #3409. Calculate both the date and time portions when a date/time format is supplied for the TEXT function.
2023-03-01 19:57:49 -08:00
oleibman bef3a0066b Misplaced Xml Writing Chart Label FillColor (#3404)
* Misplaced Xml Writing Chart Label FillColor

Fix #3397. Move code to correct location.

* Update Issue3397Test.php

No need for spacing patch - just fix it now.

* Minor Fix

See discussion at bottom of PR #2856.
2023-03-01 19:19:41 -08:00
MarkBaker 79d817fcdf Update to ReadMe 2023-03-01 19:24:22 +01:00
Mark Baker 51026a4807 Merge pull request #3424 from PHPOffice/ReferenceHelper_Stricter-TypingCasting
Stricter typing for ReferenceHelper methods
2023-03-01 18:55:45 +01:00
Mark Baker 6d5af9338f Merge branch 'master' into ReferenceHelper_Stricter-TypingCasting 2023-03-01 18:50:25 +01:00
oleibman 1fc9728818 PhpStan 10.3 (#3425)
Address the usual collection of new messages. This will supersede PR #3417 and PR #3421.
2023-03-01 09:28:58 -08:00
MarkBaker 09acdab939 Stricter typing for ReferenceHelper methods; and performance improvements for cell sorting in ReferenceHelper callbacks
Scrutinizer can only be appeased by adding extra code to pre-define variables that don't need to be pre-defined, and that makes for additional code overhead in a routine that needs to be as performant as possible; so "scrutinizer be damned!"
2023-03-01 18:09:12 +01:00
dependabot[bot] 9a4c6a1d2b Bump squizlabs/php_codesniffer from 3.7.1 to 3.7.2 (#3420)
Bumps [squizlabs/php_codesniffer](https://github.com/squizlabs/PHP_CodeSniffer) from 3.7.1 to 3.7.2.
- [Release notes](https://github.com/squizlabs/PHP_CodeSniffer/releases)
- [Commits](https://github.com/squizlabs/PHP_CodeSniffer/compare/3.7.1...3.7.2)

---
updated-dependencies:
- dependency-name: squizlabs/php_codesniffer
  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>
2023-03-01 08:33:32 -08:00
dependabot[bot] fe62c40048 Bump friendsofphp/php-cs-fixer from 3.14.3 to 3.14.4 (#3422)
Bumps [friendsofphp/php-cs-fixer](https://github.com/PHP-CS-Fixer/PHP-CS-Fixer) from 3.14.3 to 3.14.4.
- [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.14.3...v3.14.4)

---
updated-dependencies:
- dependency-name: friendsofphp/php-cs-fixer
  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>
2023-03-01 07:10:11 -08:00
dependabot[bot] 99dbf040cf Bump mitoteam/jpgraph from 10.2.4 to 10.2.5 (#3419)
Bumps [mitoteam/jpgraph](https://github.com/mitoteam/jpgraph) from 10.2.4 to 10.2.5.
- [Release notes](https://github.com/mitoteam/jpgraph/releases)
- [Commits](https://github.com/mitoteam/jpgraph/compare/10.2.4...10.2.5)

---
updated-dependencies:
- dependency-name: mitoteam/jpgraph
  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>
2023-03-01 06:52:45 -08:00
dependabot[bot] 8b62e799ec Bump phpunit/phpunit from 9.6.3 to 9.6.4 (#3418)
Bumps [phpunit/phpunit](https://github.com/sebastianbergmann/phpunit) from 9.6.3 to 9.6.4.
- [Release notes](https://github.com/sebastianbergmann/phpunit/releases)
- [Changelog](https://github.com/sebastianbergmann/phpunit/blob/main/ChangeLog-9.6.md)
- [Commits](https://github.com/sebastianbergmann/phpunit/compare/9.6.3...9.6.4)

---
updated-dependencies:
- dependency-name: phpunit/phpunit
  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>
2023-03-01 06:43:00 -08:00
Mark Baker 717a44ae1d Merge pull request #3413 from PHPOffice/Issue-3412_Date-Format-with_decimals-interpreted-as-Number-Format
Modify Date/Time check in the NumberFormatter for decimal/fractional times
2023-02-28 12:56:05 +01:00
MarkBaker c71aedeb56 Modify Date/Time check in the NumberFormatter so that masks with a decimal/fractional time aren't misinterpreted as number masks, while still ensuring that durations are interpreted as date/time masks, and locale currency masks are still treated as numbers
A date/time with a decimal time shouldn't have a digit placeholder __before__ the decimal point, only after
2023-02-28 12:34:00 +01:00
MarkBaker d01577dfeb Update Change log 2023-02-27 17:28:35 +01:00
Mark Baker e87e0b44b9 Merge pull request #3407 from PHPOffice/Fix-docs-typo
Documentation updates
2023-02-27 17:28:00 +01:00