Skip to content

feat: PhpSpreadsheet 5.9.0 compat (CsvNoEscape, IReader2, Chart\DataTable) + native sparklines - #6

Closed
saifulferoz wants to merge 3 commits into
xiidea:mainfrom
saifulferoz:feat/phpspreadsheet-5.9-compat
Closed

feat: PhpSpreadsheet 5.9.0 compat (CsvNoEscape, IReader2, Chart\DataTable) + native sparklines#6
saifulferoz wants to merge 3 commits into
xiidea:mainfrom
saifulferoz:feat/phpspreadsheet-5.9-compat

Conversation

@saifulferoz

Copy link
Copy Markdown
Contributor

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\Csv now implements IReader2; adds set/getEscapeCharacter, set/getTestAutoDetect, and streaming sheet-listing.
  • Reader\CsvNoEscape (5.6+) — strict no-escape contract.
  • Chart\DataTable (5.9) — attached via PlotArea::setDataTable, mapped through to excelize ShowDataTable/ShowDataTableKeys.
  • Dependency pinned to ^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 excelize AddSparkline.

  • Worksheet::addSparkline(Sparkline|array) + fluent Worksheet\Sparkline builder (line/column/win_loss, high/low/first/last/negative/markers/axis/reverse, style + colors).

Testing

  • PHP: 134/134 (634 assertions)
  • Go: go vet + go test -race ./compat/... ./core/... clean, incl. save-integration tests writing real xlsx.

…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
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant