2288 Commits

Author SHA1 Message Date
oleibman 7a69387e7b Extra Annotation 2026-07-02 20:20:25 -07:00
oleibman 3a2d9e4403 Delete Unused Test Member 2026-07-02 20:05:00 -07:00
oleibman d8c6890861 Merge pull request #4926 from oleibman/issue4917
Very Minor Changes to Worksheet, Reader/Xlsx, and Worksheet/AutoFilter
2026-06-29 03:44:56 +00:00
oleibman 13edf0d8a2 More AutoFilter Tweaks 2026-06-25 17:08:15 -07:00
oleibman 8fd7c56ef0 Consistent HighestRow/Column After Row/Column Delete
Fix #943, which went stale a long time ago, and is now reopened. I believe that the specific problem in that issue was actually mostly resolved some time ago. However, `highestRow/Column` produces questionable results when the delete range overlaps the highest row/column. That is fixed by this PR.

In addition, `removeRow/Column` allow the specification of a non-negative value for `numberOfRows/Columns`. But the expected results in those cases are not defined, and the actual results probably do not meet user expectations. I believe that very few, if any, users are taking advantage of this "feature", but we may as well straighten it out. For 0 rows/columns, I think it makes perfect sense to do nothing. As for negative - if `removeRow(5, 2)` says to remove 2 rows *starting* with 5, I think `removeRow(5, -2)` ought to remove (up to) 2 rows *ending* with 5. The undefined behaviors are changed to act as described in this paragraph.
2026-06-24 08:41:09 -07:00
oleibman a8aeaaefed Merge pull request #4919 from oleibman/nogetfilter
Readers Should Directly Access readFilter
2026-06-21 04:01:01 +00:00
oleibman feb3b2e472 Merge pull request #4915 from oleibman/charttweaks
Avoid Hard-Coding Some Chart Xml Attributes
2026-06-21 03:26:36 +00:00
oleibman 4d185b711b Merge pull request #4914 from oleibman/misleading
Permit Ignoring 'Misleading Format' Tag
2026-06-21 03:26:12 +00:00
oleibman 0e81e6a4ce Merge branch 'master' into nogetfilter 2026-06-18 11:38:52 -07:00
oleibman b65aecdcec Readers Should Directly Access readFilter
A number of interesting performance ideas have been submitted by @kemo. PR #4833 optimizes Xls Reader in a number of different ways. One of those, slightly modified, is to use the protected `readFilter` property which is available to all classes which inherit from `BaseReader` (which all our supported readers do), rather than call the `getReadFilter` method to obtain it (often in a loop). That applies to all readers, not just Xls, and is such a good idea that I am fast-tracking it ahead of 4833. Gnumeric, Ods, Xls, Xlsx, and Xml will all receive small performance boosts from it. Csv already does this, so no change is needed there. Html and Slk do not appear to do any filtering; possibly work for another day.
2026-06-18 10:04:39 -07:00
oleibman e623d5411b WIP Why Is This File Needed? 2026-06-17 20:56:44 -07:00
oleibman 94abde43f8 Slightly More Coverage 2026-06-17 15:07:20 -07:00
oleibman 7d0f2ad706 Avoid Hard-Coding Some Chart Xml Attributes
Writer/Xlsx/Chart hard-codes a lot of output values. While nobody has reported a problem involving these, it makes sense to me to copy those values over from what Xlsx/Reader/Chart read, rather than hard-coding them. This involves adding some new properties to Chart and Layout, all, naturally, initialized to the values that we have been hard-coding.
- Chart\date1904
- Chart\lang
- Chart\pageMargins
- Chart\pageSetup
- Layout\bodyPr

With one exception, I have not investigated any of the new properties in depth. That may come in time. The one I did look at is `date1904`. Chances are that it should match the equivalent spreadsheet setting, but it won't matter if there are no dates on your chart, and it often won't matter even if you do. It may well matter if you are using a `date axis`. While looking into that, it became apparent that some Shared Date conversions need to be a bit more flexible, specifying an optional `calendar` parameter rather than relying on the Spreadsheet `calendar` (which is not accessible while processing the chart) or the Shared\Date `calendar` (which is accessible).
2026-06-16 20:08:46 -07:00
oleibman 1876d6062f Permit Ignoring 'Misleading Format' Tag
Building on PR #3508 and PR #4393, which allowed ignoring 5 different cell 'errors'. Adding this new one should have been dead easy, but MS, in its own inscrutable way, decided to complicate this by making the xml attribute require its very own namespace, unlike any of its relatives.

There are supposed to be several ways to activate this tag. One is to enter a date in cell A1, then in cell B1 enter the formula `=A1`, and set B1's numeric format to `General`.
2026-06-16 19:45:13 -07:00
oleibman c5e0e261d5 Merge pull request #4911 from oleibman/issue413
Chart DataTable
2026-06-13 03:36:44 +00:00
oleibman 961346a5d7 Merge pull request #4910 from oleibman/issue411
Allow Use of Multiple Ranges When Setting Style
2026-06-13 03:36:23 +00:00
oleibman 7a4574dcd1 Merge pull request #4909 from oleibman/issue863
Navigate Cell as Cursor
2026-06-13 03:35:59 +00:00
oleibman dbea64cb03 Chart DataTable
Fix #413, which went stale in 2018 and is now reopened. A DataTable can be used on a chart in place of a Legend (or in addition to one, but it doesn't really make sense to have both). The fix was substantially developed by @topaDev before the issue went stale. This PR provides basic support for reading and writing DataTables on charts. The new sample on this PR shows them in action. They have obscure features which are not implemented (e.g. `glow`); those will have to wait for another day.
2026-06-11 06:43:42 -07:00
oleibman a028eea314 Allow Use of Multiple Ranges When Setting Style
Fix #411, which went stale in 2018 and is now reopened. You can get a style for a set of cells which uses multiple ranges, e.g. `A1:B2,C5:H10`, but we throw an exception if you try to change the style. I don't know how useful that is, but it's been requested and it's pretty easy to implement with recursion.

The comma in the ranges represents the `union` operator. `getStyle` is very permissive - it will allow almost anything to be specified. However, attempts to use a space as the `intersection` operator, or, indeed, many other nonsense strings, will still be permitted for `getStyle` but will continue to throw an Exception if an attempt is made to alter the style.
2026-06-11 06:30:20 -07:00
oleibman 46f4b8995a Additional Methods and Tests 2026-06-10 13:30:10 -07:00
oleibman b65783bdeb Navigate Cell as Cursor
Fix #863, which went stale in 2019 and is now reopened. Add methods to `Cell` which operate in a cursor-like manner, allowing you to change to cells on the right, left, down, or up.
2026-06-09 17:02:05 -07:00
oleibman 6a0d4ff527 No lumOff for Radar Charts
Fix #661 (marked stale in 2018, but now reopened). That issue was already mostly resolved by many changes to Xlsx Chart Writer logic some time ago. However, a new problem popped up. PR #2950 added `brightness` logic to Xlsx Reader and Writer. That was done primarily for the benefit of scatter charts. Xlsx Writer writes two brightness properties `lumMod` and `lumOff`. These values are complete complementary (if you know one, you know the other), so I am not sure why both are needed, but my scatter chart testing indicated that they were. It turns out that Radar charts can also set brightness, but, if the writer specifies both `lumMod` and `lumOff`, the resulting chart is slightly off. There may be more to this, but that's all I can deal with for now - I suppress writing `lumOff` if we're writing a radar chart. If there are other problems in this area, I will wait for them to be reported. None of the existing radar chart samples used the brightness properties; however, the example attached to 661 did. It is added as a new Sample, and tests are added.
2026-06-09 12:26:11 -07:00
oleibman fd5f72edd7 Merge pull request #4906 from oleibman/strikesubsup
Minor Coverage Improvement Reader/Xlsx
2026-06-08 03:21:59 +00:00
oleibman 1f7dd42482 Minor Coverage Improvement Reader/Xlsx 2026-06-07 20:03:44 -07:00
oleibman 45f6b78792 Merge branch 'master' into perf/xlsx-xmlreader-streaming 2026-06-07 07:10:21 -07:00
oleibman fd773844c2 Merge branch 'master' into perf/csv-streaming-encoding 2026-06-07 06:57:32 -07:00
oleibman 9698573e32 getChartIndex
It requires an index to an array which needs to be supplied as a string, even though the array is indexed exclusively by int. It is called only once in the code base, by some inefficient code which becomes much simpler when restructured and eliminates the call altogether. It is not independently tested. The use case for its existence is not clear. It should probably just be deprecated. However, for now, I'm just allowing the parameter to be int|string, rather than just string, and adding tests.
2026-06-04 12:40:57 -07:00
oleibman d80d762af1 Merge branch 'master' into issue4889 2026-06-01 08:06:46 -07:00
oleibman ad2285dac7 Merge pull request #4892 from oleibman/stanchanges
Phpstan Changes
2026-06-01 13:53:56 +00:00
oleibman 14a641f924 Phpstan Changes
A large volume of changes due to "sealed" arrays. Some are sensible; some are very confusing and are handled with `ignore` annotations.

Modules in src with changed code (as opposed to doc-blocks or annotations) are:

- DateTimeExcelDays
- Reader/Xlsx
- Reader/Xlsx/AutoFilter
- Reader/Xlsx/Chart
- Reader/Xlsx/ConditionalStyles
- Reader/Xlsx/TableReader
2026-06-01 01:14:59 -07:00
oleibman 38f346661b Bug in FIXED Function
Fix #4889. Function was not outputting correct number of decimals when thousands separator was omitted.
2026-05-31 09:26:18 -07:00
oleibman 9260bd841f Merge pull request #4886 from oleibman/ireader2
Add IReader2 Interface with listWorksheetInfo/Names
2026-05-31 15:52:34 +00:00
oleibman e322f54078 Merge pull request #4877 from oleibman/issue4875
Html Writer Apply Rotation To Images
2026-05-31 15:00:47 +00:00
oleibman b5a41165f7 Merge pull request #4880 from oleibman/reusedisconnect
Reusing Disconnected Spreadsheet
2026-05-31 14:37:53 +00:00
oleibman 974b349dc5 Close One Other Possible Vector 2026-05-28 13:50:08 -07:00
oleibman 06ac231e32 More Tests 2026-05-25 19:51:04 -07:00
oleibman 76bb021c6b More Tests 2026-05-25 11:06:33 -07:00
oleibman 67d8bd2505 Facilitate Migrating From IReader to IReader2 If Needed
Probably shouldn't be needed, but just in case.
2026-05-23 22:54:44 -07:00
oleibman 66f08ba960 Add IReader2 Interface with listWorksheetInfo/Names
Fix #4883, hopefully in a non-breaking manner.
2026-05-23 20:23:26 -07:00
oleibman 2b89a7bb7a Block Phar Only 2026-05-23 19:47:24 -07:00
oleibman 37b41a16b7 Reusing Disconnected Worksheet
Throws exception if you subsequently attempt `createSheet(0)`. Fix that.
2026-05-21 10:03:15 -07:00
oleibman aeb3775f9a A Little Less Hideous, A Little More Flexible 2026-05-16 16:37:51 -07:00
oleibman a2a6ccdeef Html Writer Apply Rotation To Images
Fix #4875. If rotation is applied to a Drawing, Html Writer will now generate the appropriate Css. This will cause the image to be rotated for Html, Dompdf, and Mpdf; Tcpdf does not recognize the rotation Css.
2026-05-14 21:54:49 -07:00
oleibman 0d9203b6b2 Reject phar Protocol in Unexpected Format
Reject `phar:///whatever` as input filename.
2026-05-14 21:26:12 -07:00
oleibman 7cc6e4e580 Merge pull request #4872 from oleibman/upgrades
Combine Dependabot Changes
2026-05-02 02:40:06 +00:00
oleibman 5c8c20686f Combine Dependabot Changes
Someting seemed to be wrong with push setup. We'll see if it's fixed.
2026-05-01 19:17:45 -07:00
William Desportes 5eb433e08b fix: don't infer cell t attribute from formula source when pre-calc is off
writeCellFormula() falls back to using $cellValue (the formula source) as
$calculatedValue when getPreCalculateFormulas() is false. The source is
always a string, so the is_string($result) branch always fires, every
formula cell ends up with t="str" — even those whose formula evaluates
to a number or boolean.

Some readers (notably older LibreOffice and Gnumeric) treat t="str" as
a hint that the cell is a string, and either skip recomputation or
present a #NAME error for numeric formulas they would otherwise compute
correctly.

Fix: leave $calculatedValue null and $calculatedValueString empty when
pre-calc is off. The type-inference branches no longer fire, so no t
attribute is written. The surrounding writeElementIf already guards <v>
emission on getPreCalculateFormulas(), so no cached value is written
either — readers see "formula with no cached value, no type hint",
respect the workbook's fullCalcOnLoad="1", and recompute on open.

Updates the existing PreCalcTest assertion to match: <c r="B2"><f>3+A3</f></c>
instead of <c r="B2" t="str"><f>3+A3</f></c>.
2026-04-29 19:27:57 +02:00
oleibman 2f9ddd04ef Support UTF-16 and UTF-32 Without Endian-ness and BOM
My research indicates they should be treated as Big-Endian.

This leaves UTF-7 as the only encoding known to be unsupported by CsvChunk; it will be handled by parent.
2026-04-29 08:38:44 -07:00
oleibman 8e92f0d343 UTF-16 Surrogates
Chunk routine would fail if chunk ended between two halves of a surrogate. Fix that.

UTF-7, UTF-16 and UCS-2 (no endian-ness specified and no BOM), UTF-32 and UCS-4 (no endian-ness specified regardless of BOM) all revert to parent routine.
2026-04-28 19:57:39 -07:00
oleibman 4449293121 Merge branch 'master' into perf/csv-streaming-encoding 2026-04-20 21:21:20 -07:00