Comments (14)
I have been attempting to add support for types (:string or :number) which is successful and I think will be in the next release.
As for the date I have been having troubles getting axlsx
to output anything except the integer representation of the Date or Time. In ODS I had date and time working mostly but we now run into issues with date formatting which could get pretty specific to xlsx or ods formats. If someone creates a pull request to add full support for dates & formatting for both ods & xlsx that would be great. But I don't want to add a half baked solution to this.
from spreadsheet_architect.
The numeric cells should now be formatted correctly in v1.2.2
from spreadsheet_architect.
First of all, thanks for your fast response.
I just tested v1.2.2 and at least on my system (Linux with LibreOffice) numeric values are now allways text, even in an xls export.
This my be partly related to a german LibreOffice, where decimal seperator is ',' and floats are (of course) exported with a '.'
But integer values are now preceded with a hyphen even in xls and ods
from spreadsheet_architect.
I just released v1.2.3 which fixes the cell type logic. So the integers should be working correctly. I could possibly make a branch where you can test out manual cell types which you could use to test your german floats and dates if you want to play around with it.
from spreadsheet_architect.
I created a branch that supports manual cell types. The supported types are:
:date, :time, :integer, :float, :string
Feel free to test this out and see if it fixes any of your problems and as a base point to create a pull request for this feature if you are so inclined.
from spreadsheet_architect.
Just tested the new versions
on branch manual_cell_types:
with format xls:
- integer: works
- float: works (no problems with german format)
- string: works
- date: does not work - resulting in integer representation
with format ods:
- integer: does not work - empty cells
- float: works (no problems with german format)
- string: works
- date: works (shows date_time)
on branch master
with format xls or ods
- integer: does not work => preceded with " ' " e.g. '4
- float: does not work => preceded with " ' " e.g. '1.2 ; even with english localization in LibreOffice
- date: does not work => comes as string in english format e.g. 2015-12-30
from spreadsheet_architect.
For me on master using LibreoOffice on OSX with ods and xlsx I am not getting the '
on integers or floats numbers.
from spreadsheet_architect.
Are you using the defining spreadsheet_columns
method or just using default active record columns?
from spreadsheet_architect.
I'm using defined spreadsheet_columns, but all the numeric and date values are just database attributes.
But it just came to my mind, that actually my "floats" aren't floats but decimals. But that woud not explain the integer problem. Gonna try it with default active record columns tomorrow.
from spreadsheet_architect.
Sorry for the delay. I just did set up a new rails app (ruby-2.2.3, rails 4.2.6, sqlite, spreadsheet_architect-1.2.3) with just a standard scaffold for testing. Here's what I found:
Everything works well (in .ods and .xlsx, with german and english localization) for all numeric values (integer, float, decimal), as long as I'm not defining spreadsheet_columns. As soon as I define spreadsheet_columns, all numeric values are strings in the spreadsheets, preceded with a '
.
With both methds dates come as strings in english format.
When using the branch manual_cell_types, the problem becomes even more interesting:
If I do not define spreadsheed_columns, ods-export is rather broken: Integers result in empty cells, floats and even dates are exported correctly. xlsx-export fails with:
Invalid Data: decimal. Cell.type must be one of [:date, :time, :float, :integer, :string, :boolean, :iso_8601].
If I define spreadsheet colums without setting the type explicitly, all numeric values are strings again, and date is again a string in english format (Integers are not empty) for ods and xlsx.
If I set the type for each value explicitly, xlsx-export works fine for all numeric values, but date switches to the integer representation. Ods-export delivers empty cells for integers, floats and decimals are handled correctly, even the date is a date.
That's my findings so far. Just tell me if you need more information.
from spreadsheet_architect.
Can you include some samples of your spreadsheet_columns
methods that you used for testing the various branches?
from spreadsheet_architect.
class Foo < ActiveRecord::Base
include SpreadsheetArchitect
def computed_float
int_number.to_f / 100
end
#def spreadsheet_columns
# [:id, :int_number, :float_number, :decimal_number, :date, :name, :computed_float]
#end
#def spreadsheet_columns
# [
# ['Id', :id, :integer],
# ['Int Number', :int_number, :integer],
# ['Float Number', :float_number, :float],
# ['Decimal Number', :decimal_number, :float],
# ['Date', :date, :date],
# ['Name', :name, :string],
# ['Computed Float', :computed_float, :float]
# ]
#end
end
from spreadsheet_architect.
I just released v1.2.4 which should fix the determination of cell type for symbol methods ex :computed_float
. The manual cell types branch has been updated as well with the symbol method fix and should work correctly for ODS integers. Im not sure why XLSX failed because it shouldn't be setting the :decimal
type automatically it should convert it to :float
, see if it works with the new version. Thanks for all your help with testing by the way.
from spreadsheet_architect.
v2.0.0 was just released which includes support for manual types.
from spreadsheet_architect.
Related Issues (20)
- Time cell in ODS file HOT 8
- Add ability to pass :instances option to SpreadsheetArchitect class methods HOT 3
- Improve test suite automation HOT 3
- Add ability to pass an alternative method name as a symbol to the :spreadsheet_columns option HOT 2
- Add conditional_row_styles option HOT 2
- Axlsx deprecation warning HOT 3
- Argument column_widths does not seem to work HOT 5
- Time formatting problem HOT 4
- Keep the header row from scrolling HOT 5
- Unable to use my own spreadsheet_column method HOT 1
- Support caxlsx gem HOT 7
- ODS column type(s) ineffective HOT 5
- XLSX_COLUMN_TYPES "already initialized constant" warning HOT 1
- Add support for :active_pane to XLSX :freeze option HOT 1
- Add option to remove all default styles HOT 1
- Add support for hyperlinks HOT 9
- How to add a value to a specific cell using spreadsheet architecture gem? HOT 2
- I'm running out of memory .... HOT 2
- Add support for Proc/lambda on column_types HOT 2
- [Feature Request] I'd like to be able to highlight a different cell in each row HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from spreadsheet_architect.