Skip to content

Add minimal XLSX export support - #22

Open
donatj wants to merge 2 commits into
masterfrom
feature/minimal-xlsx-export
Open

Add minimal XLSX export support#22
donatj wants to merge 2 commits into
masterfrom
feature/minimal-xlsx-export

Conversation

@donatj

@donatj donatj commented Sep 1, 2026

Copy link
Copy Markdown
Member

Summary

  • add a minimal XlsxEngine that mirrors SpreadsheetML cell support
  • package worksheets as streamed Office Open XML using the existing ZipStream dependency
  • add integration coverage and CI ZIP support

Validation

  • vendor/bin/phpunit
  • vendor/bin/phpcs
  • vendor/bin/php-cs-fixer fix --dry-run --diff --sequential
  • LibreOffice headless XLSX-to-CSV smoke test

Copilot AI lite review requested due to automatic review settings September 1, 2026 04:18

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 XlsxEngine to generate a minimal .xlsx (OOXML) archive via ZipStream.
  • 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);
}
}
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.

2 participants