Add minimal XLSX export support - #22
Open
donatj wants to merge 2 commits into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
Adds first-class XLSX export capability to the exporter by introducing a new XlsxEngine that writes a minimal Office Open XML workbook as a streamed ZIP archive, plus integration coverage and CI/dev dependencies to support ZIP-based validation.
Changes:
- Introduce
XlsxEngineto generate a minimal.xlsx(OOXML) archive viaZipStream. - Add an integration test that validates the produced ZIP entries and key XML values (workbook, sheets, core properties).
- Update docs and CI/dev requirements to include XLSX support and ZIP tooling.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| test/Integration/XlsxTest.php | New integration test that validates XLSX ZIP contents and XML structure/values. |
| src/Engines/XlsxEngine.php | New streaming OOXML XLSX writer using ZipStream, with minimal worksheet/style/core-props support. |
| README.md | Document XLSX as a supported format and add XlsxEngine API docs. |
| composer.json | Add ext-zip to dev requirements (used by integration test validation). |
| .mddoc.xml.dist | Update supported formats list to include XLSX. |
| .github/workflows/ci.yml | Ensure CI installs the zip extension to run XLSX-related tests. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+127
to
+131
| private function corePropertiesXml() : string { | ||
| $createdTime = gmdate('Y-m-d\TH:i:s\Z', $this->createdTime ?: time()); | ||
|
|
||
| return '<?xml version="1.0" encoding="UTF-8" standalone="yes"?><cp:coreProperties xmlns:cp="http://schemas.openxmlformats.org/package/2006/metadata/core-properties" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><dcterms:created xsi:type="dcterms:W3CDTF">' . $createdTime . '</dcterms:created><dcterms:modified xsi:type="dcterms:W3CDTF">' . $createdTime . '</dcterms:modified></cp:coreProperties>'; | ||
| } |
Comment on lines
+77
to
+87
| foreach( $this->worksheetData as $index => $sheetData ) { | ||
| rewind($sheetData['stream']); | ||
| $zip->addFileFromStream('xl/worksheets/sheet' . ($index + 1) . '.xml', $sheetData['stream']); | ||
| } | ||
|
|
||
| try { | ||
| $zip->finish(); | ||
| }catch( OverflowException $exception ) { | ||
| throw new OutputException('Zip Overflow', $exception->getCode(), $exception); | ||
| } | ||
| } |
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
Validation