roo-rb / roo

Roo provides an interface to spreadsheets of several sorts.
MIT License
2.78k stars 503 forks source link

fix to_csv not working with ODS when there is a boolean cell #546

Closed kcheung closed 3 years ago

kcheung commented 3 years ago

fix to_csv not working with ODS when there is a boolean cell by conditionally using sheet_for when formatting boolean values for Roo::Excelx.

Summary

This is a bug fix for Roo::Formatters::CSV#cell_to_csv when an ODS file has a boolean cell which causes the undefined metthod sheet_for method to be called on a Roo::OpenOffice object

What happens without this fix:

to_csv errors on ODS files wih boolean cells

Other Information

Related Issue: https://github.com/roo-rb/roo/issues/545

Let me know if this is an appropriate solution, I felt that this was the right path as the test in TestRoo#test_cell_boolean performs similar logic. However, I also tried to call onecell.to_s for both Excelx and OpenOffice booleans cells and that did work but i'm not confident enough to remove the existing logic so for now, this conditionoal will fix the ODS issue.