4582 Commits

Author SHA1 Message Date
Adrien Crivelli ab4e834777 Updates dependencies 2024-05-11 14:13:29 +07:00
Adrien Crivelli 8968062e8d Drop PHP 8.0 support
This is according to our formal, published, policy to only support
EOL PHP after 6 months.

See https://phpspreadsheet.readthedocs.io/en/latest/#php-version-support

Also consolidate documentation in a single place, not in the README,
because it's a pain to maintain almost-duplicated-but-not-really
documentation.
2024-05-11 14:09:30 +07:00
Adrien Crivelli dbed77bd3a 2.1.0 2.1.0 2024-05-11 11:17:56 +07:00
oleibman 791c8cf9a5 Merge pull request #4019 from oleibman/issue3995
Html Reader Non-UTF8 Charsets
2024-05-10 06:28:21 +00:00
oleibman bdcbc0481b Update reading-and-writing-to-file.md 2024-05-09 23:21:26 -07:00
oleibman f8e31b367b Update CHANGELOG.md 2024-05-09 23:07:12 -07:00
oleibman 4577f615c4 Merge branch 'master' into issue3995 2024-05-09 22:49:11 -07:00
oleibman 148165cbe9 Make New Function Static 2024-05-08 23:37:13 -07:00
oleibman d38b7cb35f Merge pull request #4016 from oleibman/stan9a
Better Definitions for Mixed Parameters and Values Part 1 of Many
2024-05-09 06:28:54 +00:00
oleibman b2befb4426 Correct Wrong-Case Directory Name 2024-05-06 16:50:02 -07:00
oleibman 09c9a310a0 Html Reader Non-UTF8 Charsets
Fix #3995. Fix #866. Fix #1681. Php DOM loadhtml defaults to character set ISO-8859-1, but our data is UTF-8. So Html Reader alters its html so that loadhtml will not misinterpret characters outside the ASCII range. This works for UTF-8, but breaks other charsets. However, loadhtml uses the correct non-default charset when charset is specified in a meta tag, or when the html starts with a BOM. So, it is sufficient for us to alter the non-ASCII characters only when (a) the data does not start with a BOM, and (b) there is no charset tag.

This will allow us to use:
- UTF-8 files or snippets without BOM, with or without charset
- UTF-8 files with BOM (charset should not be specified and will be ignored if it is)
- UTF-16 files with BOM (charset should not be specified and will be ignored if it is)
- all charsets which are ASCII-compatible for 0x00-0x7f when the charset is declared. This applies to ASCII itself, many Windows and Mac charsets, all of ISO-8859, and most CJK and other-language-specific charsets.

We cannot use:
- UTF-16BE or UTF-16LE declared in a meta tag
- UTF-32, with or without a BOM (browser recommendation is to not support UTF-32, and most browsers do not support it)
- unknown (to loadhtml) or non-ASCII-compatible charsets (EBCDIC?)

I will note that the way I detect the `charset` attribute is imperfect (e.g. might find it in text rather than a meta tag). I think we'd need to write a browser to get it perfect. Anyhow, it is about the same as XmlScanner's attempt to find the `encoding` attribute, and, if it's good enough there, it ought to be good enough here.
2024-05-06 16:43:23 -07:00
oleibman 8d5577a3c4 Improved Test for ConvertUOM
Scrutinizer balked at quotes around key 'Unit Name'; no reason not to use 'UnitName' instead.

Having done that, several ConvertUOM tests seemed a little unconvincing. Replaced them with improved versions.
2024-05-05 06:14:28 -07:00
oleibman 64f354eb6e Better Definitions for Mixed Parameters and Values Part 1 of Many
Improve documentation within program by making explicit what types of values are allowed for variables described as "mixed". In order to avoid broken functionality, this is done mainly through doc-blocks. This will get us closer to Phpstan Level 9, but many changes will be needed before we can consider that.

Executable code change is to add 2 new methods to Cell - `getValueString` and `getCalculatedValueString`, which are the same as the methods without the String suffix, except that they always return a string result. These are invoked at several places in the code where it makes sense, in particular by Writer code.
2024-05-05 04:37:46 -07:00
oleibman c56a58358e Merge pull request #4006 from oleibman/issue4004
RTL Text Alignment in Xlsx Comment
2024-05-05 11:17:55 +00:00
oleibman 5d1d8671a6 Update CHANGELOG.md 2024-05-05 04:14:24 -07:00
oleibman 4a7fa143f7 Merge pull request #4007 from oleibman/issue4001
Xml Reader Rich Text
2024-05-05 04:26:34 +00:00
oleibman d2a69aec9d Update CHANGELOG.md 2024-05-04 21:13:31 -07:00
oleibman db602bde89 Merge branch 'master' into issue4001 2024-05-04 21:05:15 -07:00
oleibman 8485cd195f Merge pull request #4003 from oleibman/issue3999
Improvements to Xml Reader
2024-05-05 03:55:44 +00:00
oleibman 8441d3d899 Merge pull request #4011 from PHPOffice/dependabot/composer/phpstan/phpstan-1.10.67
Bump phpstan/phpstan from 1.10.66 to 1.10.67
2024-05-01 18:15:03 +00:00
oleibman e64d99a91f Merge branch 'master' into dependabot/composer/phpstan/phpstan-1.10.67 2024-05-01 10:57:17 -07:00
oleibman 18bc613ec8 Update Slk.php 2024-05-01 10:50:52 -07:00
dependabot[bot] f012091c81 Bump phpstan/phpstan from 1.10.66 to 1.10.67
Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 1.10.66 to 1.10.67.
- [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.10.66...1.10.67)

---
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-05-01 17:49:27 +00:00
oleibman 13fe27182c Merge pull request #4012 from PHPOffice/dependabot/composer/tecnickcom/tcpdf-6.7.5
Bump tecnickcom/tcpdf from 6.7.4 to 6.7.5
2024-05-01 17:46:44 +00:00
oleibman ae59fe429e Merge pull request #4010 from PHPOffice/dependabot/composer/friendsofphp/php-cs-fixer-3.54.0
Bump friendsofphp/php-cs-fixer from 3.53.0 to 3.54.0
2024-05-01 17:45:38 +00:00
oleibman 1eaadb3643 Merge pull request #4009 from PHPOffice/dependabot/composer/squizlabs/php_codesniffer-3.9.2
Bump squizlabs/php_codesniffer from 3.9.1 to 3.9.2
2024-05-01 17:45:17 +00:00
oleibman 1d83e38ad1 Merge pull request #4008 from PHPOffice/dependabot/composer/dompdf/dompdf-2.0.8
Bump dompdf/dompdf from 2.0.4 to 2.0.8
2024-05-01 17:44:56 +00:00
dependabot[bot] 0543c1ff8d Bump tecnickcom/tcpdf from 6.7.4 to 6.7.5
Bumps [tecnickcom/tcpdf](https://github.com/tecnickcom/TCPDF) from 6.7.4 to 6.7.5.
- [Changelog](https://github.com/tecnickcom/TCPDF/blob/main/CHANGELOG.TXT)
- [Commits](https://github.com/tecnickcom/TCPDF/compare/6.7.4...6.7.5)

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

Signed-off-by: dependabot[bot] <support@github.com>
2024-05-01 11:42:11 +00:00
dependabot[bot] d0198b8720 Bump friendsofphp/php-cs-fixer from 3.53.0 to 3.54.0
Bumps [friendsofphp/php-cs-fixer](https://github.com/PHP-CS-Fixer/PHP-CS-Fixer) from 3.53.0 to 3.54.0.
- [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.53.0...v3.54.0)

---
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-05-01 11:41:59 +00:00
dependabot[bot] f19eac78d6 Bump squizlabs/php_codesniffer from 3.9.1 to 3.9.2
Bumps [squizlabs/php_codesniffer](https://github.com/PHPCSStandards/PHP_CodeSniffer) from 3.9.1 to 3.9.2.
- [Release notes](https://github.com/PHPCSStandards/PHP_CodeSniffer/releases)
- [Changelog](https://github.com/PHPCSStandards/PHP_CodeSniffer/blob/master/CHANGELOG.md)
- [Commits](https://github.com/PHPCSStandards/PHP_CodeSniffer/compare/3.9.1...3.9.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>
2024-05-01 11:41:53 +00:00
dependabot[bot] 9167f00278 Bump dompdf/dompdf from 2.0.4 to 2.0.8
Bumps [dompdf/dompdf](https://github.com/dompdf/dompdf) from 2.0.4 to 2.0.8.
- [Release notes](https://github.com/dompdf/dompdf/releases)
- [Commits](https://github.com/dompdf/dompdf/compare/v2.0.4...v2.0.8)

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

Signed-off-by: dependabot[bot] <support@github.com>
2024-05-01 11:41:48 +00:00
oleibman d40a1cfa52 Xml Reader Rich Text
Fix #4001. Thanks to @SlowFox71 who reported the problem and developed most of the solution. This PR adds Rich Text support to the XML reader. The Xml Spreadsheet stores Rich Text as Html tags, children of the ss:Data tag using a specific namespace. These can be parsed into a RichText object using existing method Helper/Html::toRichTextObject. There are 2 items which need special attention.

First, for attributes like bold or italic, Excel uses the appropriate Html tag (e.g. `<B>`). However, for an attribute like color, Excel uses `<Font html:Color="#FF0000">`, with a prefix on the Color tag. PhpSpreadsheet's Html parser cannot cope with the prefix. The parser is changed to strip `html:` from attribute names for the Font tag.

The example cited by the user used a `<BR />` to indicate a line break in the data. However, it appears that, at least some of the time, Excel will instead use `&#10;` to indicate a line break. The existing parser reduces one or more whitespace characters in the text to a single space, and so `&#10;` will wind up disappearing. I am not sure why the existing code does this, but I do know that I am not willing to break it. Instead, I've added an optional boolean parameter `$preserveWhiteSpace` to `toRichTextObject`. If false (default), the existing logic will be used; but if true, substitution for whitespace characters in the text will not happen.
2024-04-30 23:51:13 -07:00
oleibman 455f1129bf RTL Text Alignment in Xlsx Comment
Fix #4004. RTL text can be included in a comment, and will display correctly, but the comment as a whole will be left-aligned. There already exists an `alignment` property for Comment, but it is unused. This PR will allow that property to be set, and to be read from and written to an Xlsx spreadsheet when possible.

The Xml tags that govern this property are found, unusually, in a drawing Vml file. The important property is `x:TextHAlign`, which can be set to Left, Right, Center, Justified, or Distributed. There are other tags which seemed like they were relevant to this problem, but I don't think they actually matter:
```xml
  <v:textbox style='mso-direction-alt:auto'>
   <div style='text-align:right;direction:rtl'></div>
  </v:textbox>
```
2024-04-30 22:22:03 -07:00
oleibman 10ec62707e Improvements to Xml Reader
Fix #3999. Fix #4000. Fix #4002. Several bug reports and feature requests for Xml Reader arrived practically simultaneously. They are all small and hit the same code modules, so I have bundled them together in one PR.
- `loadSpreadsheetFromString` might try to open a file with a falsy name (like '0'), which results in an exception with a misleading message (or a completely unexpected result if a file with that name exists). Code will still throw an exception, but the message will no longer be misleading, and no file I/O will be attempted.
- function `trySimpleXmlLoadString` is deprecated. It should never have been implemented with public visibility, and the fact that it was made the fix above a little more difficult than it would otherwise have been. It is replaced with a private equivalent.
- Style reader function `parseStyles` will now use a better namespace-aware method of reading its Xml data. Peculiarly, the Xml for the Style elements can either include or not a namespace prefix. This is probably because the global namespace and the styles namespace are the same. The existing prefix-based code does not recognize their equivalence, but the new namespace-based code does. Xml Reader continues to use prefix-based code in several other places.
- Border line styles with Weight omitted or equal to 0 have been treated as no border, but they should be treated as 'hair' thickness.
- Support for Zoom is added to Xml Reader.
- In support of the above, new properties (and getters and setters) zoomScalePageLayoutView and zoomScaleSheetLayoutView are added to Worksheet/SheetView. (As far as I can tell, Excel does not support Sheet Layout View for Xml spreadsheets).
- Support is added for those new properties in Xlsx Reader and Writer.
- Xls Reader and Writer seem to work okay without changes. There is one test where Xls shows a different value for one of the properties than Xml or Xlsx, but the spreadsheet looks okay and I don't see any practical consequences of the difference.
- PageBreak support is added to Xml Reader.
- Code for writing out Column Page Breaks in Xlsx Writer was wrong (and, unsurprisingly, untested). A one-line change fixes it, and tests are added.
2024-04-27 16:42:42 -07:00
oleibman 34272571f5 Merge pull request #3992 from oleibman/issue3988
Table Filter Buttons
2024-04-20 14:32:03 +00:00
oleibman 98ab11cf5f Table Filter Buttons
Fix #3988. Excel allows a table to have some colums with filter buttons exposed and some with filter buttons hidden. However you cannot do this in "native" Excel - VBA is required for this feature. PhpSpreadsheet is supposed to be able to handle this, but Xlsx/Writer/Table had a bug. The `filterColumn` tags in the xml should be children of the `autoFilter` tag, but were generated as siblings. Moving one statement fixes that problem. Fixing that exposed another problem - autoFilter `showHideRows` was not properly recognizing that a filter could exist without any rules, which is what happens when a table filter button is hidden. Another simple change fixes that problem.

The parent issue correctly points out the problem for Column D in samples/Table/01_Table. However, that sample also has a problem with Column A - unlike columns B and C, there is a filter appled to column A, so its dropdown button should appear different than those in B and C. That problem is also corrected with the fixes above. I also added some formal tests based on that sample.
2024-04-17 10:45:58 -07:00
oleibman e9f03dfe36 Merge pull request #3946 from Phenix789/master
Fix default value for Conditional::$text
2024-04-17 02:27:33 +00:00
oleibman c84bdbf015 Add Test Case 2024-04-16 19:18:40 -07:00
oleibman 35030fa66d Merge pull request #3973 from Chris53897/patch-2
chore: fix ci deprcation (github pages)
2024-04-15 00:36:53 +00:00
oleibman a6b0405906 Merge pull request #3972 from Chris53897/patch-1
chore: fix ci deprecations
2024-04-15 00:36:30 +00:00
oleibman b732e55b61 Merge pull request #3984 from PHPOffice/dependabot/composer/friendsofphp/php-cs-fixer-3.53.0
Bump friendsofphp/php-cs-fixer from 3.51.0 to 3.53.0
2024-04-15 00:35:54 +00:00
oleibman df26a76a30 Update FunctionPrefix.php 2024-04-14 17:23:41 -07:00
dependabot[bot] 9c502b7d02 Bump friendsofphp/php-cs-fixer from 3.51.0 to 3.53.0
Bumps [friendsofphp/php-cs-fixer](https://github.com/PHP-CS-Fixer/PHP-CS-Fixer) from 3.51.0 to 3.53.0.
- [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.51.0...v3.53.0)

---
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-04-15 00:23:24 +00:00
oleibman a076cfd00b Merge pull request #3970 from PHPOffice/dependabot/composer/squizlabs/php_codesniffer-3.9.1
Bump squizlabs/php_codesniffer from 3.9.0 to 3.9.1
2024-04-15 00:20:59 +00:00
oleibman 350162c938 Merge pull request #3971 from PHPOffice/dependabot/composer/mpdf/mpdf-8.2.3
Bump mpdf/mpdf from 8.2.2 to 8.2.3
2024-04-15 00:09:57 +00:00
oleibman 5748f3fe62 Merge pull request #3983 from PHPOffice/dependabot/composer/phpunit/phpunit-9.6.19
Bump phpunit/phpunit from 9.6.17 to 9.6.19
2024-04-15 00:08:39 +00:00
oleibman 0c0040840d Merge pull request #3966 from PHPOffice/dependabot/composer/phpstan/phpstan-1.10.66
Bump phpstan/phpstan from 1.10.59 to 1.10.66
2024-04-15 00:08:09 +00:00
oleibman e401743465 Merge pull request #3967 from PHPOffice/dependabot/composer/tecnickcom/tcpdf-6.7.4
Bump tecnickcom/tcpdf from 6.6.5 to 6.7.4
2024-04-14 23:35:38 +00:00
dependabot[bot] 40ccfb9b65 Bump phpunit/phpunit from 9.6.17 to 9.6.19
Bumps [phpunit/phpunit](https://github.com/sebastianbergmann/phpunit) from 9.6.17 to 9.6.19.
- [Release notes](https://github.com/sebastianbergmann/phpunit/releases)
- [Changelog](https://github.com/sebastianbergmann/phpunit/blob/9.6.19/ChangeLog-9.6.md)
- [Commits](https://github.com/sebastianbergmann/phpunit/compare/9.6.17...9.6.19)

---
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-04-14 23:29:32 +00:00
dependabot[bot] 419806484a Bump phpstan/phpstan from 1.10.59 to 1.10.66
Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 1.10.59 to 1.10.66.
- [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.10.59...1.10.66)

---
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-04-14 23:29:25 +00:00