feat: PhpSpreadsheet 5.9.0 compat (CsvNoEscape, IReader2, Chart\DataTable) + native sparklines - #6
Closed
saifulferoz wants to merge 3 commits into
Closed
Conversation
…r2, Chart\DataTable) Re-baseline against phpoffice/phpspreadsheet 5.9.0 and implement the three public classes it added, so none of them throws in strict mode. Readers: - Reader\IReader2: the 5.8+ listing contract (load, listWorksheetInfo, listWorksheetNames). - Reader\Csv now implements IReader2 and gained set/getEscapeCharacter, set/getTestAutoDetect, and the sheet-listing methods (single streaming pass for dimensions — no full materialisation). - Reader\CsvNoEscape (5.6+): extends Csv with the strict no-escape contract (escape pinned to '', auto-detect false; re-enable attempts throw). Charts: - Chart\DataTable (5.9): full API (H/V border, outline, keys toggles) attached via PlotArea::setDataTable. Chart::buildSpec emits a dataTable block gated to area/bar/col/line (Excel/excelize render a data table only for those). The Go spec maps it onto excelize PlotArea.ShowDataTable / ShowDataTableKeys; the H/V border flags collapse onto excelize's single outline toggle (documented). Also: pin the dependency to ^5.9 in bench/composer.json and the Dockerfile surface gate; drop the three now-covered classes from .compat-surface.json; update COMPAT.md / MISSING.md. Tests: +6 PHP cases (io.php, wave44.php) and a new Go chart_test.go. PHP suite 132/132 (616 assertions); go vet + go test -race ./compat/... clean.
PhpSpreadsheet has no sparkline object model — it can neither read nor write Excel sparklines — so this is an easy-excel-native feature in the style of addNativeChart, backed by excelize's AddSparkline. Layers: - Go: compat.TranslateSparkline builds excelize.SparklineOptions from a JSON spec, validating type (line|column|win_loss) and location/dataRange pairing up front. New opSparkline op queued via Workbook.AddSparkline and applied in applyOpPhase3; easy_excel_add_sparkline bridge export. - PHP: Native::addSparkline; Worksheet::addSparkline(Sparkline|array); a fluent Worksheet\Sparkline builder (addPair, high/low/first/last/negative/markers/ axis/reverse toggles, style + per-marker colors with ARGB->RGB normalisation). Colors are normalised to 6-hex RGB (leading # and ARGB alpha stripped) to match excelize. The Sparkline builder aliases to a phantom PhpOffice\...\Sparkline name like every Compat class; documented as easy-excel-only. Docs: COMPAT.md (native/extras row), NATIVE.md (raw API + spec example). Tests: PHP +2 cases (builder mapping, raw-array + validation guards); Go compat translator tests + core save-integration tests (real xlsx via excelize, data survives the overlay; bad spec rejected at queue time). PHP 134/134 (634 assertions); go vet + go test -race ./compat/... ./core/... clean.
saifulferoz
marked this pull request as draft
July 28, 2026 03:20
… OOM/panic DoS) govulncheck flagged GO-2026-5960 (unbounded row-index allocation in excelize's worksheet parser) as reachable via AddChart/AddComment/AddDataValidation. Fixed in excelize v2.11.0. v2.11.0 reshaped the chart title API — Chart/axis Title is now a ChartTitle struct with a Paragraph field rather than []RichTextRun; updated TranslateChart accordingly. Also bump the transitive golang.org/x/text to v0.39.0 to clear GO-2026-5970 at the module level. govulncheck now reports no called or imported vulnerabilities (the sole remaining module-level notice is x/crypto/openpgp, unmaintained, fix N/A, not called). go test -race across all packages and the PHP suite (134/134) pass.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Updates the polyfill for phpoffice/phpspreadsheet 5.9.0 and adds a native sparkline feature.
5.9.0 surface coverage (8add72b)
Reader\IReader2— the 5.8+ listing contract (load,listWorksheetInfo,listWorksheetNames).Reader\Csvnow implementsIReader2; addsset/getEscapeCharacter,set/getTestAutoDetect, and streaming sheet-listing.Reader\CsvNoEscape(5.6+) — strict no-escape contract.Chart\DataTable(5.9) — attached viaPlotArea::setDataTable, mapped through to excelizeShowDataTable/ShowDataTableKeys.^5.9; surface re-baselined; COMPAT.md / MISSING.md updated.Native sparklines (7716d9e)
PhpSpreadsheet has no sparkline support, so this is an easy-excel-native extra (like
addNativeChart), backed by excelizeAddSparkline.Worksheet::addSparkline(Sparkline|array)+ fluentWorksheet\Sparklinebuilder (line/column/win_loss, high/low/first/last/negative/markers/axis/reverse, style + colors).Testing
go vet+go test -race ./compat/... ./core/...clean, incl. save-integration tests writing real xlsx.