Skip to content

Fix xlsx export was faulty when exporting results with exactly 0 or 1 result #6

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 12, 2025

Conversation

Phocacius
Copy link
Member

No description provided.

@Phocacius Phocacius requested review from astroidex and Copilot June 12, 2025 09:00
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes the XLSX export logic to correctly handle result sets of exactly 0 or 1 rows.

  • Corrects a typo in the export comment
  • Updates exportAction to always add header rows for single-row exports and inject a dummy row for zero-row exports
  • Adds a 2.0.1 entry in the changelog

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
Resources/public/queryBuilder.element.js Fixed typo in export method comment
Element/HttpHandler.php Refined XLSX export logic for 0 or 1 rows
CHANGELOG.md Bumped version to 2.0.1 and documented the fix
Comments suppressed due to low confidence (2)

Element/HttpHandler.php:108

  • There are currently no tests for XLSX exports with 0 or 1 rows; adding unit tests for these edge cases will help prevent regressions.
if ($exportFormat === ExportResponse::TYPE_XLSX && count($rows) > 0) {

Resources/public/queryBuilder.element.js:87

  • [nitpick] Consider capitalizing "Excel" for consistency with its official name.
* Execute SQL and export as excel or data.

Copy link
Member

@astroidex astroidex left a comment

Choose a reason for hiding this comment

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

works fine with libre office
tested 1 or no result

@Phocacius Phocacius merged commit ad653dc into master Jun 12, 2025
@Phocacius Phocacius deleted the work/fix-0-or-1-result-export branch June 12, 2025 09:51
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.

None yet

2 participants