Skip to content

How to export component as excel (axlsx) #1410

Discussion options

You must be logged in to vote

Hey @PedroAugustoRamalhoDuarte! Interesting use case you've got here. This feels like it might be more of a question for caxlsx folk, as adding this functionality seems no different to working with a plain old Ruby object. From what I can gather there, you may need to implement #to_xlsx on your components so that they can be passed to caxlsx in this way. acts_as_xlsx has a very generic implementation that you can take some inspiration from: https://github.com/caxlsx/acts_as_caxlsx/blob/master/lib/acts_as_xlsx/ar.rb#L48

If you'd rather your axlsx logic in separate files, you could build a concern that defines to_xlsx to look for and read an xlsx.axlsx folder from __dir__, then evaluate it …

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@PedroAugustoRamalhoDuarte
Comment options

@boardfish
Comment options

Answer selected by PedroAugustoRamalhoDuarte
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants