Commit Graph

6692 Commits

Author SHA1 Message Date
Dmytro Kulyk d6ae22caaa Changelog: link #5017 and #5018 2026-09-28 10:17:27 +03:00
Dmytro Kulyk c6f1560b2e Ods Reader : Read the hyperlink LibreOffice keeps in a cell style
LibreOffice writes the link of a cell that is not plain text (a number,
a boolean, a date, a formula) as style:hyperlink and loext:hyperlink in
the style:table-cell-properties of the cell's automatic style, which is
how it saves a Xlsx file with such links as Ods. The reader looked only
for text:a, so those links were lost.

The reader now maps each cell style to its link and uses it when the
cell has no text:a. A cell with no style of its own takes the default
cell style of its column, as LibreOffice does for A1 in the test file.
2026-09-28 10:15:28 +03:00
oleibman 458bffb33e Merge pull request #5014 from dkulyk/ods-number-cell-link
Ods Reader and Writer : Keep the hyperlink of a non-text cell
2026-09-28 01:29:14 +00:00
Dmytro Kulyk 141a082132 Changelog: link #5013 and #5014 2026-09-28 03:26:48 +03:00
Dmytro Kulyk 1e87f6f8d3 Ods Reader and Writer : Keep the hyperlink of a non-text cell
The Ods Writer wrote text:a only for string cells, so a link on a
number, boolean, date or formula cell was lost. The Ods Reader looked
for text:a only in string cells, so it would not have read one back.

All cell types now go through one helper that writes the displayed text,
wrapped in text:a when the cell has a hyperlink. The helper asks
hasHyperlink() first, since getHyperlink() would add an empty one. The
Reader takes text:a from the paragraphs of any cell type.
2026-09-28 03:26:42 +03:00
oleibman 58b70b605d Merge pull request #5012 from dkulyk/ods-internal-link
Ods Reader and Writer : Use the ODF sheet separator in internal links
2026-09-28 00:19:21 +00:00
oleibman 92df59707e Merge branch 'master' into ods-internal-link 2026-09-27 17:15:34 -07:00
oleibman 8951d33c46 Merge pull request #5010 from dkulyk/ods-image-alt
Ods Writer and Reader: write and read the description of an image
2026-09-28 00:08:35 +00:00
oleibman 2effdbf7df Merge branch 'master' into ods-image-alt 2026-09-27 17:04:51 -07:00
oleibman 6ae40fd4a1 Merge pull request #5008 from dkulyk/ods-hyperlink-mutation
Ods and Csv Writers: do not add a hyperlink to every cell they write
2026-09-27 23:48:54 +00:00
Dmytro Kulyk b7491da03d Check which hyperlinks the Xlsx writer writes, not only that it does not throw 2026-09-28 02:00:11 +03:00
Dmytro Kulyk a208e6c8cb Changelog: link #5011 and #5012 2026-09-27 01:36:20 +03:00
Dmytro Kulyk 08d3797ed1 Ods Reader and Writer : Use the ODF sheet separator in internal links
The Ods Writer turned sheet://Sheet2!A1 into #Sheet2!A1, keeping the
Excel separator, while ODF and LibreOffice write #Sheet2.A1. The Ods
Reader only swapped the prefix, so a link written by LibreOffice became
sheet://Sheet2.A1, and a later save to Xlsx wrote location="Sheet2.A1",
which does not resolve.

The Writer now writes a dot after the sheet name, quoted or not. The
Reader turns that dot back into "!" when a cell address follows it, and
still accepts "!", which older releases wrote and which LibreOffice keeps
when the address after it also parses as R1C1 (#'My Sheet'!C3). A named
range, with no sheet, stays as it is.
2026-09-27 01:32:24 +03:00
Dmytro Kulyk 7b78a5f462 Changelog: link #5009 and #5010 2026-09-27 01:23:28 +03:00
Dmytro Kulyk 9c88c515e5 Ods Writer and Reader: Write and read the description of an image
The Ods Writer wrote no svg:desc for an image, so the description given
with setDescription() was lost, and LibreOffice exported the image to a
tagged PDF as a figure without alternative text. The Reader read no
svg:desc either, including the one LibreOffice writes itself.

The Writer now writes the description as svg:desc on the frame, and
the Reader reads it back.
2026-09-27 01:22:32 +03:00
Dmytro Kulyk 442f04310a Changelog: link #5007 and #5008 2026-09-27 01:14:35 +03:00
Dmytro Kulyk 3714121dab Ods and Csv Writers : Do not add a hyperlink to every cell they write
Cell::getHyperlink() creates and stores an empty Hyperlink when the cell
has none. The Ods Writer called it on every string cell, and the Csv
Writer with preferHyperlinkToLabel on every cell through getCell(),
which also created the empty cells in between. Saving a workbook
therefore changed it: after a save to Ods, every string cell had a
hyperlink with an empty URL, and a later save to Xlsx threw "Invalid
parameters passed." on them.

Both Writers now ask hyperlinkExists() first, and the Csv Writer no
longer goes through getCell().
2026-09-27 01:10:25 +03:00
oleibman be40c66829 Merge pull request #5002 from u01jmg3/main
Grammar
2026-09-23 14:47:56 +00:00
Jonathan Goode a44c54a3b0 Grammar 2026-09-23 12:26:14 +01:00
oleibman 3d8a362412 Merge pull request #4999 from oleibman/darklogo2
More Documentation Tweaks
2026-09-23 02:23:06 +00:00
oleibman 5be7f650e2 Update CHANGELOG.md 2026-09-22 19:19:13 -07:00
oleibman 50e7d71751 Merge branch 'master' into darklogo2 2026-09-22 18:49:23 -07:00
oleibman d56edf1171 Merge pull request #4995 from PHPOffice/xlswritetweak
Rename and Change Visibility Of 2 Xls Writer Properties
2026-09-23 01:38:17 +00:00
oleibman 6017f29a78 Merge pull request #4992 from oleibman/nounderscore
Deprecate `_calculateFormulaValue` for `calculateFormulaValue`
2026-09-23 01:32:06 +00:00
oleibman 428a495b6c Merge pull request #4989 from oleibman/badxmldate
Minor Xml Reader Improvements
2026-09-23 01:31:07 +00:00
oleibman 671625ec41 Merge pull request #4997 from gechuanpan/fix-value-product-description-4996
Fix VALUE() treating product text as a date
2026-09-23 01:27:28 +00:00
oleibman 7dc2893461 Consistent Upper/lower Case for Home URL
Also a change is needed for the material themes to enable "Edit on Github".
2026-09-22 17:35:18 -07:00
oleibman d12232529b Twear DarkImages Bookmarklet
It should always work on first try now. Previously, it needed to be executed twice under some circumstances.
2026-09-20 16:29:06 -07:00
oleibman d13f34b84e More Documentation Tweaks
Special handling in javascript and css for any image whose `alt` value starts with `Logo`, rather than targeting one specific value.

Remove 2 no-longer relevant statements from `extra.css`.

Add css member for `mkdocs` theme.

Add link to PhpSpreadsheet site to the bottom line of each page for `readthedocs` and `mkdocs` themes. In theory, these links should already exist, and they do locally, but not, for some reason, when run on readthedocs.io. This link is different from the `Edit on Github` link at the top, which is a kind of interesting feature.

Add a bookmarklet on the main page for toggling images to dark mode, which would probably be the preference for users employing dark mode. Images are usually left unchanged in dark mode, but almost all our images are screenshots, and dark mode might be appropriate for them.
2026-09-19 19:57:45 -07:00
youzixu 1cb0a040b6 Address review: order date tokens and simplify DateValue return.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-20 09:23:48 +08:00
oleibman 4fc80fd9a2 Merge pull request #4998 from PHPOffice/oleibman-patch-1
Update reading-and-writing-to-file.md
2026-09-19 16:30:14 +00:00
oleibman 994aa79c3f Update reading-and-writing-to-file.md 2026-09-19 09:20:49 -07:00
youzixu a0c098b26c Avoid casting mixed to string in isDateTimeString()
PHPStan level 10 rejects (string) $value. VALUE() already converted
the argument with StringHelper::convertToString() before this check.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-18 17:56:38 +08:00
youzixu 2b018e147e Fix VALUE() treating product text as a date
Excel returns #VALUE! for strings like "5V 2.1A - EU Wall Adaptor",
but DateValue's parser accepted them via date_parse("5V-2-1A").

Fixes #4996
2026-09-18 17:31:01 +08:00
oleibman 1636e0512b Rename and Change Visibility Of 2 Xls Writer Properties
BIFFWriter defines two properties, `_data` and `_datasize` as public. There is no reason for them to be public, and no reason for the leading underscore. Change them to protected, and change their names.
2026-09-17 09:34:28 -07:00
oleibman 066e4da72c Merge pull request #4994 from PHPOffice/doctweak
Minor Documentation Tweaks
2026-09-17 16:12:11 +00:00
oleibman 2ad3b70018 Minor Documentation Tweaks
`extra.css` specifies a background color for `td` and `th`. I believe it is used only for the `readthedocs` theme, and I do not see why it is needed there; it slightly interferes with dark mode. Comment it out rather than deleting it, just in case a need is established for it.

Color the top bar for `zensical`.

`mkdocs` theme has a weird problem described in its yml file. There is a workaround, but I'm not comitted to it, so make it available but don't use it yet.
2026-09-17 08:00:51 -07:00
oleibman b8f21b72e4 Update CHANGELOG.md 2026-09-16 22:04:57 -07:00
oleibman 1d04209a26 Merge branch 'master' into nounderscore 2026-09-16 22:00:06 -07:00
oleibman eb18727acf Merge pull request #4993 from oleibman/changelog20260915
Update Changelog
5.10.0
2026-09-17 03:54:50 +00:00
oleibman 0aeff66114 Update Changelog 2026-09-16 20:49:48 -07:00
oleibman 29e6ae425b Merge pull request #4991 from samuelwei/master
Remove copyright header from Xls Writer files
2026-09-17 03:40:39 +00:00
Samuel Weirich 14401c4cb5 Remove copyright from Xls writer, keep author attribution 2026-09-16 16:03:20 +00:00
oleibman 0b22c08ceb Deprecate _calculateFormulaValue for calculateFormulaValue
Remove the leading underscore in a `Calculation` method. PR #4713 eliminated all use of this method in the test suite, but there are still a handful of uses in source. It is not quite equivalent to `calculateFormula`, so it needs to be retained, and needs to be `public` (possibly `internal` but I'm not ready to go there yet). However, the leading underscore is misleading, so drop it. Since it is public, avoid a breaking change by retaining the old name as essentially an alias of the new.

The configuration file for phpcs includes an option to not flag leading underscores in method names. This is the only method for which that option is needed, so it is being removed.
2026-09-16 08:39:39 -07:00
oleibman 2de29384aa Merge commit from fork 2026-09-15 20:36:53 -07:00
oleibman 94590951d7 Merge commit from fork 2026-09-15 19:22:36 -07:00
oleibman 89f455c133 Merge commit from fork
* Security Patch

* Minor Improvement to `unentity`

* More Unentity Tweaks
2026-09-15 19:03:30 -07:00
oleibman 2e3c4fe3c6 A Bit Of Coverage 2026-09-14 10:44:58 -07:00
oleibman c91bae3fed Minor Xml Reader Improvements
Six years ago, my PR #1557 was merged. It was written mainly to improve code coverage in Xml Reader, but some changes and enhancements were made to the Reader code. I noted in that ticket: "File templates/Excel2003XMLTest.xml, used in some tests, is not
readable by a current version of Excel. I have substituted a new file
excel2003.xml to be used in its place. I have not deleted the original
in case someone in future (possibly me) wants to see what it needs to
make it usable." That time has finally arrived.

Excel could not open the file. LibreOffice could, and did a pretty decent job, but something seemed wrong with how it handled formulas. PhpSpreadsheet could not read it, because a field identified as a date/timestamp was wrong - it specified a time-of-day hour as `288`. I made a copy of the file, changed the invalid hour to something valid. It turns out that was not Excel's problem - it still could not read the file. But, for the first time that I can recall, Excel produced decent diagnostic messages! They were in a location that you can't get to through Windows Explorer, even with "hide system files" turned off. However, you could get to it through Windows Command Prompt. There were 56 problems, all involving formulas (which was probably LibreOffice's problem). The formulas were all of the form:

```
of:=[.B1]+[.C1]
```
Now, XML spreadsheets use RC format rather than A1 format for its cells. The formula above is of a style that LibreOffice uses, but Excel does not understand it. It is looking for something like:

```
ss:Formula="=RC[-6]+RC[-5]
```

Excel2003Xml doesn't understand the formula in the file, but PhpSpreadsheet does. But, before it could do so, we had to eliminate the Exception when we tried to parse the invalid date/time. So, the first order of business was to wrap the Xml Reader date conversion logic in a try/catch. This allowed PhpSpreadsheet to read the file, and then to save it as an Xlsx file. Then we could open the Xlsx file in Excel, and save it as Xml. Voilà. We have converted the unreadable Xml file to a readable one. LibreOffice can also read the new file, and the formulas are now correct. BTW, I have no idea what was intended on sheet "Report Data" cells G17:G29. They all subtract a value from an empty cell, so the result is always negative, and try to format it as a date (which Excel doesn't like for negative numbers). Whatever that problem is, there is no need to fix it at this time.

At this point, a little cleanup was still needed. The Xml file was using some strange named styles, e.g. `Medium Date`. I was able to get a list of these with the google query `excel 2003 ooxml named number formats`. However, the list came only in the AI portion of the response; I could not find a link to anything permanent. So I went with what it showed me.

The earlier PR suggested that handling UTF-16 for this format would be difficult. However, saving the now-usable UTF-8 Xml file as UTF-16 with BOM results in a file which PhpSpreadsheet (and Excel and LibreOffice) can read without any code changes.
2026-09-14 07:39:37 -07:00
oleibman 9e6263ebe8 Merge pull request #4988 from oleibman/optionalopenssl
Make `openssl` Extension Optional
2026-09-11 16:33:46 +00:00