spreadsheet_architect
spreadsheet_architect copied to clipboard
Time cell in ODS file
Hi, first of all thank you for your work on Spreadsheet Architect, you make life easier for thousands of developers.
I am using the 2.0.2
version of the gem and I have an issue while trying to create a ODS file with a Time in a cell.
Here is my code :
SpreadsheetArchitect.to_ods(data: [[Time.now]], header: false)
When i open with LibreOffice the produced file the cell value is 0
(displayed 30/12/1899
) and the format is set to date
.
Am I missing something ?
Thanks for your help
What happens when you do this?
SpreadsheetArchitect.to_ods(data: [[Time.now]], header: false, column_types: [:time])
That may fix it in the meantime however its likely an issue with the rodf
gem. Time cells may need some additional work and tests added.
The cell displays 2018-01-29
, the value is '2018-01-29
. The cell seems to be formatted as Number (default format I suppose).
Thanks for you help, I will try to investigate rodf
as soon as possible.
I am the maintainer of rodf
as well. I have been working on a solution this morning. I should have something for you to test soon.
Related rodf issue: thiagoarrais/rodf#19
Improvements have been made to the cell types on the develop branch of rodf
.
Please try the following in your Gemfile to test the changes:
gem 'rodf', github: 'thiagoarrais/rodf', branch: :develop
gem 'spreadsheet_architect'
If you wouldnt mind testing all column types for any bugs: :string, :float, :date, :time, :currency, :percentage
Thank you for your speed. I will test this soon and comment on the rodf related issue.
Turns out date/time formatting is kind of complicated in ODS. Until the bug is dealt with in some way over in RODF, I am going to convert all :date / :time cells to :string using to_s
as a sensible default
As of v2.1.0 (Released today), All date or time cells in ODS spreadsheets will be converted to strings using to_s
until the situation is properly fixed in RODF.