Commit Graph

3585 Commits

Author SHA1 Message Date
MarkBaker 8ef9aa8251 Minor performance tweak 2022-05-23 00:08:06 +02:00
oleibman 7c1c896959
Change and Re-enable URLImageTest (#2844)
Disabled it earlier because its reliance on an external site not under our control was causing problems. URL in spreadsheet is now changed to point to an image in phpspreadsheet.readthedocs.io, which should be more reliable. Test is re-enabled.
2022-05-21 08:07:59 -07:00
oleibman 567b9601b0
Allow Csv Reader to Store Null String in Spreadsheet (#2842)
Fix #2840 (and also #2839 but that's Q&A, not an issue). Csv Reader does not populate cells which contain null string. This PR provides an option for the reader to store null strings as it does with any other string.
2022-05-21 07:21:14 -07:00
oleibman ef031e74e1
More Chart Fixes (#2841)
* More Chart Fixes

Taking up where #2828 left off. Most of the following changes are demonstrated in 32readwriteChartWithImages1:
- Adds support for "scheme" colors (because rgb, theme, and index colors just weren't enough for Excel) for DataSeriesValues. See issue #2299.
- For chart titles (including axis labels), rather than a font name, Excel supplies a 3-fold series of font names for Latin, East Asian, and Complex Scripts. New properties `latin`, `eastAsian`, and `complexScript` are added to the Font class. I frankly have no idea how, or even if, you can set these in Excel; my test case (sample 32readwriteScatterChart7) is a result of manually editing the XML.
- Add support for subscript/superscript to chart titles. This requires a new property `baseLine` in Font (positive=superscript negative=subscript baseline value says how high/low).
- Support for underscore with different scheme color than its text, using a new string property `uSchemeClr` in Font.
- Support for extra options for strikethrough, using a new string property `strikeType` in Font.
- Support for extra options for underscore type, using the existing string property `underline` in Font.
- I do not anticipate that any of the new Font properties will be used except for chart titles.
- If no default font overrides are found for a Rich Text element in chart titles, and no explicit font overrides are found for a Run under such an element, the font element of the Run is set to null.
- PhpSpreadsheet will always write a tag `a:pPr` and, underneath that, an empty tag `a:defRPr`, for default font settings for chart titles and axis labels. Combined with the previous bullet item, this will prevent PhpSpreadsheet from inadvertently overriding the Excel defaults (18 point bold Calibri for chart title, 10 point bold Calibri for axis labels).
- Axis labels will now be written to XML in the same manner as chart titles. Among other considerations, this means that they can now have colors. Fix #2700. Supersedes PR #2701. Demonstrated in sample 32readwriteStockChart5.

* Fix Some Chart Corruption

Fix #2817, where @bridgeplayr gives an excellent description of the problem and how it should be solved.

* Fix Bubble Charts

Sample produced corrupt output - see issue #2763. After a lot of research, solution was just re-ordering of parameters in a single function call.

Bubble 3D had not been supported at all. It is now.

Surface Charts remain corrupted.
2022-05-21 07:01:18 -07:00
oleibman 9d36e442e9
Disable URLImageTest (#2843)
This test has always been problematic in that it depends on an external site not under the control of PhpSpreadsheet, and can therefore break at any time. As it has done this morning. Disable it until a better test is available.
2022-05-21 06:46:02 -07:00
Mark Baker b8957205e1
Merge pull request #2835 from PHPOffice/Issue-2833_Null-handling-in-PRODUCT()-Function
Filter null values in PRODUCT() function

> It all looks good to me.

ty
2022-05-17 17:10:32 +02:00
Mark Baker a59b29ae11
Merge branch 'master' into Issue-2833_Null-handling-in-PRODUCT()-Function 2022-05-17 16:53:08 +02:00
oleibman 9aa1708468
Some Fixes for Scatter Charts (#2828)
* Some Fixes for Scatter Charts

Chart issues have been pouring in recently. This is a partial response to issue #2762. It implements "no joins" for scatter charts, as well as having the reader and writer handle "point size", "line width", and "color" for markers. A new boolean property `scatterLines`, with setter and getter, is added to DataSeriesValues to handle joins (default is true which means scatter plot points *are* joined by lines). Some, but not yet all, default font properties for the chart title are handled (color and, surprisingly, font name present challenges).

With these changes, sample 32readwriteScatterChart1.xlsx now looks closer to its source. There are still some differences (x-axis changes), but I think this change is already large enough. I can work on the other problems later.

The code for reading charts has not yet been converted to be namespace aware. Having a tiny island of aware code in a sea of unaware makes no sense to me, so some of the new code is likewise unaware. I hope to be able to get to it eventually, but, among other considerations, it is difficult to generate suitable test cases.

* Add Formal Tests

Essentially the same as the corresponding Samples, but with formal assertions.

* Clean Up Some Code in Reader/Xlsx/Chart

Having added code to support default font attributes as well as element-specific font attributes for chart captions, there was duplicated code between the default and specific sections. I hope that this PR makes the code easier to follow.

* Add Support for Font Name and Color to XLSX Chart Titles

XML layout for these in new files differs from what program was expecting. Not sure if program expectations were wrong, or if this is a change to Excel since initial development.

* Minor Improvement

Handle theoretical case where Chart title has text but no font information.

* Support Bezier Curve and Scaling of X-Axis on Scatter Plot

For Bezier, need to specify `<c:smooth>` tag in addition to already supplied `<c:scatterStyle val="smoothMarker">`

For X-Axis, scatter needs to supply both X and y axis as `<c:valAx>` rather than `<c:catAx>` for X.
2022-05-17 07:48:24 -07:00
MarkBaker db4dac3de9 Filter null values in PRODUCT() function, as they don't affect the calculation in any way, and actually require additional code handling if they're present within the calculation itself 2022-05-17 16:40:14 +02:00
Mark Baker 4df236a688
Merge pull request #2830 from PHPOffice/ChartSheet
Read ChartSheets with the Xlsx Reader if includeCharts is enabled
2022-05-17 16:24:51 +02:00
MarkBaker b4ba57acaa Unit tests for listWorksheetNames() and listWorksheetInfo() with a ChartSheet 2022-05-17 16:11:53 +02:00
MarkBaker e02f25bf48 Update listWorksheetNames() and listWorksheetInfo() to accept ChartSheet information 2022-05-17 15:44:24 +02:00
MarkBaker c66baa44ea Update Change Log 2022-05-17 15:31:44 +02:00
Mark Baker cb81f44091
Merge branch 'master' into ChartSheet 2022-05-17 15:26:09 +02:00
Mark Baker db00b90a12
Merge pull request #2834 from PHPOffice/Issue-2833_Null-handling-in-PRODUCT()-Function
NULL value handling in PRODUCT() Excel function
2022-05-17 13:09:04 +02:00
MarkBaker 2b9b42d5c6 Update Change Log 2022-05-17 13:03:52 +02:00
MarkBaker 79f5cf99f6 Resolve Issue #2833, NULL value handling in PRODUCT() Excel function 2022-05-17 12:56:21 +02:00
MarkBaker a33ed026e9 Update Change Log 2022-05-16 16:35:35 +02:00
MarkBaker 94963f4b97 Type and return tpe cleanups 2022-05-16 15:49:02 +02:00
MarkBaker 198878b347 Add unit tests for ChartSheet reading 2022-05-16 13:30:30 +02:00
MarkBaker 34dd0a929e Read ChartSheets with the Xlsx Reader if includeCharts is enabled; although we're reading it as a normal worksheet that simply contains a chart at cell A1, xOffset 0, yOffset 0, with no data
And Handle ChartSheets in the Xlsx Writer
2022-05-16 13:30:30 +02:00
MarkBaker 092ddbd542 Remove spurious (and out-of-date) text file from source 2022-05-13 10:32:49 +02:00
MarkBaker 5352dbed49 Changelog 2022-05-13 08:49:59 +02:00
Mark Baker ce940a35e9
Merge pull request #2827 from PHPOffice/Issue-2826_Xls-Reader-Converting-Named-Ranges-to-Relative
Fix issue with Xls Reader converting all named ranges from absolute to relative
2022-05-12 12:52:26 +02:00
MarkBaker fd44f47f62 Fix issue with Xls Reader converting all named ranges from absolute to relative 2022-05-12 12:47:18 +02:00
Mark Baker 54d82cd023
Merge pull request #2825 from PHPOffice/Column-Autofit-Indentation
Column autofit indentation
2022-05-11 20:13:04 +02:00
MarkBaker ffd900b6df composer fix 2022-05-11 20:02:58 +02:00
MarkBaker dbcb84bd4d phpstan fix 2022-05-11 19:54:16 +02:00
MarkBaker 4a4078f38f Merge branch 'master' into Column-Autofit-Indentation 2022-05-11 19:00:43 +02:00
Mark Baker a352856485
Merge pull request #2824 from PHPOffice/CalcEngine-Function-Return-Type-CellReference
Calc engine function return type cell reference
2022-05-11 18:59:13 +02:00
MarkBaker dd3ed498e9 Trying to rationalise phpstan between local and CI 2022-05-11 18:48:05 +02:00
MarkBaker 65053d711c Assertion updates 2022-05-11 16:06:44 +02:00
MarkBaker 153a3a6af6 Fix for null value passed to extractSheetTitle() 2022-05-11 16:06:19 +02:00
MarkBaker bb96542b64 Autofit adjustment for indent 2022-05-11 12:33:01 +02:00
oleibman 070bc68514
Html Reader Converting Cell Containing 0 to Null String (#2813)
Fix #2810. Repairing some Phpstan diagnostics, used `?:` rather than `??` in a few places.

2 different Html modules are affected. Also, Ods Reader, but its problem is with sheet title rather than cell contents. And, as it turns out, Ods Reader was already not handling sheets with a title of `0` correctly - it made a truthy test before setting sheet title. That is now changed to truthy or numeric. Other readers are not susceptible to this problem. Tests are added.
2022-05-10 07:33:45 -07:00
oleibman b0bfdde164
Cleanup After Phpstan Upgrade (#2800)
After Phpstan 1.6.3 upgrade, clean up some new problems that will show up if it runs under Php 8+.
2022-05-10 07:20:22 -07:00
Mark Baker 4d5a4824c4
Merge pull request #2820 from PHPOffice/Performance-Coordinates-2
Performance tweaks to calculating column string from index
2022-05-10 13:57:28 +02:00
MarkBaker 55f03a5d38 Performance tweaks to calculating column string from index 2022-05-10 13:28:18 +02:00
Mark Baker 32efe0ee45
Merge pull request #2819 from PHPOffice/Performance-Coordinates
Performance tweaks to calculating column string from index
2022-05-10 12:51:14 +02:00
MarkBaker a0ad01e91d Performance tweaks to calculating column string from index 2022-05-10 12:33:43 +02:00
Mark Baker 05d08fe787
Merge pull request #2818 from PHPOffice/Performance-Minor-Tweaks
Performance tweaks to cell address validation
2022-05-09 20:23:03 +02:00
MarkBaker 677054dd0a Performance tweaks to cell address validation 2022-05-09 15:40:17 +02:00
oleibman eb34e02085
Restore Tcpdf/Dompdf to Samples in Test Suite (#2814)
They were dropped because they weren't ready for PHP8 when we were. They are ready now.
2022-05-08 11:48:04 -07:00
oleibman 35530502d2
Allow Csv Reader to Treat String as Contents of File (#2792)
See #1285, which went stale and was closed, but recently received some positive feeback. It seems easy to implement, and the only other plaintext file format, Html, allows loading from a string. Those two reasons combined suggest that we should do it.
2022-05-07 08:24:53 -07:00
oleibman a32861a0a0
Copy from Xls(x) to Html/Pdf Loses Drawings (#2788)
Drawings in an Xlsx file are stored in such a way that Php can read their contents using the `zip:` protocol. This does not, however, work when the file is read by PhpSpreadsheet and then saved as Html or Pdf, since the browser will not recognize that protocol even if the file is available. Such drawings need to be saved in the html as embedded images in order for the copy to display them properly. This is true even when the writer is set to not embed images (default).

An additional problem arises when an Html file with an embedded image is read, because `Worksheet\Drawing::setPath` attempts to validate the path, which it cannot do for the `data:image` Url which embedded images use.

And yet another problem. Writer/Html writes out a MemoryDrawing as a png using the imagepng function; but then declares it as jpeg in the Html. This is now corrected.

And a fourth problem. Writer/Html ignores the last row if it contains nothing but a Memory Drawing, which can be true when copying an Xls file.

These changes are testable (it's how I discovered the second part of this parlay). I think it is also useful to add a sample to see the results of this type of copy.
2022-05-07 08:10:24 -07:00
Mark Baker 9776efc226
Merge pull request #2811 from PHPOffice/Ods-Writer-Bugfix-Row-Height
Fix issue with row height styles in Ods Writer
2022-05-06 21:29:19 +02:00
MarkBaker f7ca14f1f1 Fix issue with row height styles in Ods Writer 2022-05-06 21:16:12 +02:00
MarkBaker 779a5e21be Change Log update 2022-05-06 12:44:04 +02:00
Mark Baker 56509d9a3e
Merge pull request #2808 from PHPOffice/Performance-Ods-Writer
Performance Ods/Html Writers
2022-05-06 12:42:03 +02:00
Mark Baker d4f6e78c4e
Merge branch 'master' into Performance-Ods-Writer 2022-05-06 12:32:13 +02:00