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

Time cell in ODS file #14

Open
mmagn opened this issue Jan 29, 2018 · 8 comments
Open

Time cell in ODS file #14

mmagn opened this issue Jan 29, 2018 · 8 comments

Comments

@mmagn
Copy link

mmagn commented Jan 29, 2018

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

@westonganger
Copy link
Owner

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.

@mmagn
Copy link
Author

mmagn commented Jan 29, 2018

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.

@westonganger
Copy link
Owner

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.

@westonganger
Copy link
Owner

Related rodf issue: westonganger/rodf#19

@westonganger
Copy link
Owner

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

@mmagn
Copy link
Author

mmagn commented Jan 30, 2018

Thank you for your speed. I will test this soon and comment on the rodf related issue.

@westonganger
Copy link
Owner

westonganger commented Mar 9, 2018

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

@westonganger
Copy link
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants