Skip to content

Conversation

@jmcnamara
Copy link
Collaborator

Fix issue where a shared string <si></si> element doesn't contain a <t> or any other sub-element.

This is unusual and isn't produced by Excel but it is valid under the specification.

See also #573

Fix issue where a shared string <si></si> element doesn't contain
any sub-elements. This is unusual and isn't produced by Excel
but it is valid under the specification.

Closes tafia#573
Copy link

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 issue #573 by handling empty shared string elements in XLSX files. The fix ensures that a shared string element (<s></s>) without a <t> sub-element is treated as a valid empty string, which is consistent with Excel's behavior.

  • Added logic to treat empty <s></s> elements as valid empty strings
  • Improved error handling for invalid shared string table indices
  • Added test coverage for the empty shared string scenario

Reviewed Changes

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

File Description
src/xlsx/mod.rs Added handling for empty shared string elements without <t> sub-elements
src/xlsx/cells_reader.rs Added bounds checking when accessing shared strings table to prevent panics
tests/test.rs Added test case for empty shared string scenario
tests/empty_shared_string.xlsx Test fixture demonstrating the edge case

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@jiaaro
Copy link

jiaaro commented Oct 30, 2025

@jmcnamara Thank you for addressing this so quickly. ❤️ 🎉

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