Skip to content
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

[BUG] FsWorkbook can be saved to file with no worksheet present #38

Closed
omaus opened this issue Jul 19, 2023 · 1 comment
Closed

[BUG] FsWorkbook can be saved to file with no worksheet present #38

omaus opened this issue Jul 19, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@omaus
Copy link
Collaborator

omaus commented Jul 19, 2023

Describe the bug
It is possible to save an FsWorkbook with no worksheets attached. This is critical since an XLSX spreadsheet file always needs to have at least 1 worksheet with a name given. Else it is not valid and, e.g., MS Excel will tell you it is corrupted when trying to open it.

To Reproduce
Steps to reproduce the behavior:
1.

#r "nuget: FsSpreadsheet"
#r "nuget: FsSpreadsheet.ExcelIO"

open FsSpreadsheet
open FsSpreadsheet.ExcelIO

let path = "test.xlsx"

let wb = new FsWorkbook()

FsWorkbook.toFile path wb
  1. Open in MS Excel

Expected behavior
This is up to debate.
Maybe throw an error when trying to save such a workbook? Or at least give a warning? Is this even a bug at all or do we want to give the library user the freedom to artificially produce invalid XLSX files?
@HLWeil

@omaus omaus added the bug Something isn't working label Jul 19, 2023
HLWeil added a commit that referenced this issue Feb 12, 2024
@HLWeil
Copy link
Member

HLWeil commented Feb 12, 2024

Now the funciton fails if no worksheet is present.

@HLWeil HLWeil closed this as completed Feb 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants