Commit Graph

27 Commits

Author SHA1 Message Date
5550b90704 fix: infinite loop due to hidden row in XLSX.stream.to_json (#3178)
**Title:**

Fix for Incorrect Row Indexing and Infinite Loop in stream.to_json Function

**Description:**

This pull request addresses two key issues in the `stream.to_json` function of the SheetJS library:

1. **Infinite Loop**: Previously, when a row was hidden, the function skipped processing the current row without incrementing the row counter `R`, resulting in an infinite loop during execution.

2. **Incorrect Row Indexing**: The row index was incorrectly accessed using a one-based index, whereas the actual row index was zero-based. This led to unintended hidden rows being included in the stream and skipping of subsequent non-hidden rows.

**Changes:**

- Modified the hidden row check to use the correct zero-based indexing
- Incremented `R` after identifying a hidden row to ensure the loop progresses to the next row.
- Ensured that the stream correctly processes all rows, skipping hidden rows without affecting subsequent rows.

**Testing:**

- Validated that the `stream.to_json` function no longer enters an infinite loop when encountering hidden rows.
- Confirmed that the correct rows are processed and pushed to the stream, with hidden rows being appropriately skipped.

**Impact:**

This fix enhances the reliability of the SheetJS library, ensuring accurate data streaming from spreadsheets without infinite loops or incorrect row handling.

**Checklist:**

- [x] Code changes have been tested locally.
- [x] The changes adhere to the project's coding standards and guidelines.

**Additional Information:**

These changes are crucial for maintaining the library's functionality in production environments, where precise data handling is essential.

**References:**

Closes #3176.

---

Reviewed-on: sheetjs/sheetjs#3178
Co-authored-by: deepak-negi-web <deepak-negi-web@noreply.git.sheetjs.com>
Co-committed-by: deepak-negi-web <deepak-negi-web@noreply.git.sheetjs.com>
2024-08-21 05:34:31 +00:00
5a36cb423d NaN and Infinity error export
- `read` handle `Int8Array` (to support Java engines)
- `sheet_to_formulae` option to suppress values
- handle unexpected `<charset/>` (fixes #3143 h/t @dearzubi)
2024-07-04 15:54:34 -04:00
5ef49e2b96 XLML Streaming Write
- CSV Export only quote leading ID (fixes #2959)
2024-05-31 03:16:53 -04:00
e4a66516e4 remove flow array comment workarounds
- XLSB use #REF! for unsupported defined name ref (fixes #3059 h/t @NenadC2)
2024-02-02 01:52:14 -05:00
050f66ce1b version bump 0.19.0 2022-10-23 21:05:59 -04:00
2022f7f4b0 version bump 0.18.8: dateless meridien time values 2022-05-22 19:51:41 -04:00
69bb1e79a3 "side-effect free" 2022-03-19 21:54:41 -04:00
reviewher
02707848ad skipHidden for sheet_to_json [ci skip] 2022-03-11 16:26:02 -08:00
0b6ebc67da DBF preserve field properties
- DBF write type N and roundtrip C length (fixes #1888 h/t@bandizsolt)
- clean up xhr demo (fixes #2604 h/t @UP2022742)
- clean up vue / nuxt demo
2022-03-10 00:31:13 -05:00
c6a86cfe98 make stream utils available to Node ESM
- sheet_to_csv blankrows/strip (fixes #2274 h/t @dmongit)
- sheet_to_json fix dedupe (see #2460 h/t @giuliohome)
- mini build browser tests
2022-03-08 20:44:10 -05:00
a32b30414b CSV omit trailing record separator [ci skip] 2022-03-07 20:17:32 -05:00
Rohan Dhamapurkar
467020fc69 stream.to_json end (fixes #1779) 2022-03-08 05:38:45 +05:30
d6161103b1 works minutiae 2021-12-29 04:16:02 -05:00
Tor Nilsson Öhrn
4109caeadd to_csv skipHidden corner case (fixes #1508) 2019-05-15 15:49:38 -04:00
1eb1ec985a version bump 0.14.1: AutoFilter issues
- `stream.to_json` fix (fixes #167 h/t @Alex0007)
- AutoFilter `_FilterDatabase` Defined Name (fixes #1262 h/t @nitramL)
2018-11-13 15:25:51 -05:00
a9b8588e6c version bump 0.13.2: Buffer issues
- node 4.x buffer fix (fixes #1150 h/t @gabyidong)
- dependencies: CFB 1.0.8, codepage 1.14.0
- json object stream
2018-07-08 23:46:11 -04:00
5de62a947f version bump 0.12.5: ancillary utility update
- add BOM to `stream.to_csv` (fixes #1024 h/t @hr5959)
- `utils.format_cell` type (h/t @victorj2307)
- duktape niggles
- demo cleanup
2018-03-12 22:51:54 -04:00
c2ec7555fb version bump 0.11.18: infrastructure
- updated dependencies
- fixed eslint config
- fusebox demo
2018-01-23 04:07:55 -05:00
f277ebe140 version bump 0.11.16: refresh
- HTML whitespace (fixes #849 h/t @laurentauthier)
- XLML number format write (fixes #904 h/t @james-boswell)
- XLAM/XLA write
- 'array' write type
- XLSX/XLSB/XLS/XLML RTL read/write
- XLS merge cells write
- demo and typing refresh
2017-12-30 03:20:00 -05:00
935821423f version bump 0.11.1: dist cleanup
- dist scripts properly export library
- XLS/XLSB formulae quote sheet names containing spaces
- skipHidden ported to streaming CSV write
- updated codepage to 1.11.0
- flow and TS updates
- webpack demo example using dist scripts
- requirejs demo
2017-08-05 02:32:57 -04:00
5d997df419 version bump 0.10.5
- HTML output new preamble, <table> should not be in header/footer
- XLS Built-In defined names translated to XLSX _xlnm form
- README: streaming read strategies
- If approximation error is sufficiently small, assume MDW is 6
- TS rename Utils type to XLSX$Utils (see #618)
2017-06-09 21:54:33 -04:00
3fde651a8c sheet_to_html
- added to TS definition and tests
- clarified behavior of plaintext files (fixes #641 h/t @dskrvk)
- removed old test files
2017-05-16 13:45:35 -04:00
99b513875b lint and type fixes
- removed CFB test (fixes #654 h/t @wolfgang42)
- book_append_sheet optional name (fixes #652 h/t @jomel)
- strict mode compliance (h/t @simon-p-r @loongdefect @appersonj)
- flow fixes (h/t @jameskraus for help with Date#getYear)
- fixed minifier to generate ExtendScript-compatible code
2017-05-13 14:21:22 -04:00
7b4bafba49 Miscellaneous format fixes
- SSF update to address extendscript issue (fixes #608 h/t @mjdb3d)
- XLSX cellDates set date format (fixes #647 h/t @psalmody)
- ODS add stub stylesheet for Excel (fixes #649 h/t @WaqasJaved1)
- CSV with UTF8 BOM (fixes #650 h/t @charlesread)
- DIF/CSV fuzzy date speculation
- SYLK parse RC formulae
- CSF utils for manipulating workbooks
2017-05-11 03:29:59 -04:00
f51feb375a version bump 0.9.11: streaming HTML write 2017-04-16 03:31:21 -04:00
1d61054602 HTML Write support
- 'html' bookType write format
- basic HTML entity encoding (fixes #629 h/t @xkr47)
- HTML string and table merge cell fixes
- doc notes on nodejs streaming
2017-04-16 00:32:13 -04:00
51182e57ef version bump 0.9.10: nodejs performance
- xlsx.njs use dense mode by default
- CSV Streaming output for nodejs
- XLSX/XLSB error on password protected documents
- record hoppers switch on record number rather than name
2017-04-09 00:04:46 -04:00