You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@fesod.apache.org by "nkuprins (via GitHub)" <gi...@apache.org> on 2026/09/15 18:40:53 UTC

[I] [Bug] Blank cells and all-blank rows read differently in XLS and CSV than in XLSX [fesod]

nkuprins opened a new issue, #1105:
URL: https://github.com/apache/fesod/issues/1105

   ### Search before asking
   
   - [x] I searched in the [issues](https://github.com/apache/fesod/issues) and found nothing similar.
   
   
   ### Fesod version
   
   main
   
   ### JDK version
   
   any
   
   ### Operating system
   
   Linux
   
   ### Steps To Reproduce
   
   ```java
   List<List<Object>> data = Arrays.asList(
           Arrays.asList("x", "y"),
           Arrays.asList(" ", "\t"),  // whitespace only
           Arrays.asList("", ""),     // empty strings
           Arrays.asList(" ", "z"),   // one blank cell next to data
           Arrays.asList("p", "q"));
   
   for (String ext : new String[] {".xlsx", ".xls", ".csv"}) {
       File file = new File("blank" + ext);
       FesodSheet.write(file).sheet().doWrite(data);
   
       List<Map<Integer, String>> rows = FesodSheet.read(file).headRowNumber(0).sheet().doReadSync();
       System.out.println(ext + " -> " + rows);
   }
   ```
   
   ### Current Behavior
   
   The same content reads back differently depending only on the file extension:
   
   | Row written | `.xlsx` | `.xls` | `.csv` |
   |---|---|---|---|
   | `[" ", "\t"]` | skipped | `{0="", 1=""}` | `{0=null, 1=null}` |
   | `["", ""]` | skipped | `{0="", 1=""}` | `{0=null, 1=null}` |
   | `[" ", "z"]` | `{0=null, 1="z"}` | `{0="", 1="z"}` | `{0=null, 1="z"}` |
   
   So XLSX returns 3 rows, while XLS and CSV return 5 rows. XLS also returns `""` where the other formats return `null`, including in rows that have data.
   
   With `autoTrim(false)`, XLSX and XLS keep `" "` and `"\t"`, but CSV still returns `null` for them.
   
   
   ### Expected Behavior
   
   All three formats should read the same content the same way. That means following the rule the XLSX reader already applies:
   - A cell that is empty after `autoTrim`/`autoStrip` is `null`.
   - A row whose cells are all empty is an empty row, so it's skipped while `ignoreEmptyRow` is `true` (the default).
   
   Expected result for every format: `[{0=x, 1=y}, {0=null, 1=z}, {0=p, 1=q}]`.
   
   ### Anything else?
   
   The fix is to call `checkEmpty()` in the two XLS label handlers and only mark the row as `DATA` when the cell isn't empty. In CSV, trim first, then check for empty, and mark the row `EMPTY` when every cell is empty.
   
   This is a behaviour change: XLS users get `null` instead of `""`, and XLS/CSV users no longer receive all-blank rows unless they set `ignoreEmptyRow(false)`.
   
   ### Are you willing to submit a PR?
   
   - [x] I'm willing to submit a PR!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@fesod.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@fesod.apache.org
For additional commands, e-mail: commits-help@fesod.apache.org


Re: [I] [Bug] Blank cells and all-blank rows read differently in XLS and CSV than in XLSX [fesod]

Posted by "noy-solvin (via GitHub)" <gi...@apache.org>.
noy-solvin commented on issue #1105:
URL: https://github.com/apache/fesod/issues/1105#issuecomment-6058294159

   Hi @psxjoy, @delei 
   I've submitted PR #1179 that fixes this issue.
   Would love a review whenever you get a chance. Happy to adjust anything!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@fesod.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@fesod.apache.org
For additional commands, e-mail: commits-help@fesod.apache.org