Comments (5)
Okay so you cant do "#{amount} #{currency.symbol}"
this is because the method is defined on the class which does not have the method amount
or currency
, that method is on the instance.
For the first one, can you try to write it like this: '"#{amount} #{currency.symbol}"'
(notice the single quotes on the outside.)
For the second one, can you try to write it like this: '"#{reward.present? ? (reward.amount - reward.description) : I18n.t("payments.csv.no_rewards")}"'
(notice the single quotes on the outside.)
The alternative to writing them like this is that you define a method on the instance
def the_amount
"#{amount} #{currency_symbol}"
end
def the_reward
reward.present? ? (reward.amount - reward.description) : I18n.t("payments.csv.no_rewards")
end
def self.spreadsheet_columns
[
[ "Date", "I18n.l(created_at.to_date, format: :long)" ],
[ I18n.t('payments.csv.id'), :id ],
[ I18n.t('payments.csv.login'), :payer_login ],
[ I18n.t('payments.csv.email'), :payer_email ],
[ I18n.t('payments.csv.firstname'), :payer_first_name ],
[ I18n.t('payments.csv.lastname'), :payer_last_name ],
[ I18n.t('payments.csv.type'), "type.slice(0, type.index('Payment'))" ],
[ I18n.t('payments.csv.amount'), :the_amount],
[ I18n.t('payments.csv.reward'), :the_reward],
[ I18n.t('payments.csv.address'), 'try(:payer_location).try(:address_complete) || "-"' ]
]
end
Im going to look into the spreadsheet_columns
method to see if it can be moved to the instance instead of the class possibly.
from spreadsheet_architect.
Yeah you are awesome it works!!
I have just a strange behaviour in excel (last version) contents in cell are underlined. Perhaps I need to specify specific style? Or a wrong default stylesheet?
Do you know if we could hide or show column for example if we need to display different informations for each controller?
Thanks for your great work and your time!
from spreadsheet_architect.
I am releasing 1.0.5 which includes moving the spreadsheet_columns
method form the class to the instance after I deal with this underline issue. Do you think you could try it out using the options below to see if that works properly? If this works I will fix this in 1.0.5
.to_xlsx(header_style: {bold: :none}, row_style: {bold: :none})
# and
.to_xlsx(header_style: {bold: :single}, row_style: {bold: :single})
from spreadsheet_architect.
If you want to have different info per controller you can utilize the spreadsheet_columns
option when you call to_xlsx
. Though in 1.0.5 you must only use symbols methods when using this option.
from spreadsheet_architect.
I just released version 1.1.0 (which i was previously referring to 1.0.5). The spreadsheet_columns method has been moved from the class to the instance. See the Model section of the readme for new usage instructions. Also the underline issue should be fixed and should not require the underline option anymore and should work correctly with true/false
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.