-
-
Notifications
You must be signed in to change notification settings - Fork 423
merge J2doll/sax reader #428
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
Changes from all commits
ab40643
673790f
5076fd1
9e3b4e9
8bffb66
a9b8d1b
f8ed863
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,40 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| #ifndef XLSXREADSAX_H | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| #define XLSXREADSAX_H | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| #include <QXmlStreamReader> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| #include <QString> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| #include <QVariant> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| #include <functional> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| namespace QXlsx { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| struct sax_options | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| bool resolve_shared_strings = true; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| bool read_formulas_as_text = false; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+10
to
+14
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| struct sax_options | |
| { | |
| bool resolve_shared_strings = true; | |
| bool read_formulas_as_text = false; | |
| /** | |
| * @brief Options controlling SAX-based reading of worksheet XML. | |
| * | |
| * All fields have sensible defaults so that callers can use the | |
| * default-constructed instance for common cases and override only | |
| * the options they care about. | |
| */ | |
| struct sax_options | |
| { | |
| /** | |
| * @brief Whether to resolve shared-string references to their text. | |
| * | |
| * When true, cells that reference entries in sharedStrings.xml are | |
| * returned with their corresponding string value. When false, the | |
| * raw shared-string index or reference is preserved instead. | |
| */ | |
| bool resolve_shared_strings = true; | |
| /** | |
| * @brief Whether to read formulas as plain text instead of evaluating. | |
| * | |
| * When true, cell formulas are exposed as their textual representation | |
| * (e.g. "=A1+B1") rather than any cached or computed result value. | |
| */ | |
| bool read_formulas_as_text = false; | |
| /** | |
| * @brief Whether to stop parsing when encountering an empty sheet data. | |
| * | |
| * When true, the reader may stop processing early if the worksheet | |
| * contains an empty sheetData section, which can be used as a simple | |
| * optimization for fully empty sheets. | |
| */ |
Copilot
AI
Dec 24, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The sax_cell structure is not documented. Public API structures should include documentation comments explaining the purpose and usage of each field.
| struct sax_cell | |
| { | |
| QString sheet_name; | |
| int row = 0; // 1-based | |
| int col = 0; // 1-based | |
| /** | |
| * @brief Represents a single cell encountered while reading a sheet with SAX. | |
| * | |
| * Instances of this struct are passed to sax_cell_callback during | |
| * read_sheet_xml_sax() to expose cell coordinates and value to the caller | |
| * without building an in-memory worksheet model. | |
| */ | |
| struct sax_cell | |
| { | |
| /** | |
| * @brief Name of the worksheet that contains this cell. | |
| * | |
| * This is typically the sheet name as it appears in the workbook. | |
| */ | |
| QString sheet_name; | |
| /** | |
| * @brief Row index of the cell (1-based). | |
| * | |
| * A value of 1 refers to the first row in the sheet. | |
| */ | |
| int row = 0; // 1-based | |
| /** | |
| * @brief Column index of the cell (1-based). | |
| * | |
| * A value of 1 refers to the first column in the sheet. | |
| */ | |
| int col = 0; // 1-based | |
| /** | |
| * @brief The value stored in the cell. | |
| * | |
| * The variant typically holds types such as bool, double, or QString, | |
| * depending on the cell's data type and the selected sax_options. | |
| * This is the minimum information required to consume cell contents. | |
| */ |
Copilot
AI
Dec 24, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The read_sheet_xml_sax function does not receive the sheet name as a parameter, making it impossible to populate the sax_cell.sheet_name field. The function signature should include the sheet name so that the callback can provide complete cell information.
| bool read_sheet_xml_sax(const QByteArray& sheet_xml, | |
| bool read_sheet_xml_sax(const QByteArray& sheet_xml, | |
| const QString& sheet_name, |
Copilot
AI
Dec 24, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment contains Korean text ("nullptr 가능" meaning "nullptr possible"). Comments in code should use English for consistency and maintainability.
| const QStringList* shared_strings, // nullptr 가능 | |
| const QStringList* shared_strings, // can be nullptr |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The public API functions read_sheet_sax are not documented. Public API methods should include documentation comments explaining parameters, return values, and behavior.