I'm saving Rails data into an Excel spreadsheet using the gem AXLSX_RAILS.
I have some text fields that are stored as HTML in the database.
This is my attempt to convert the HTML to text:
sheet.add_row ['REVENUE DESCRIPTION', strip_tags(@costproject.revenue).gsub!(" ", "")]
That works to remove the HTML tags.
But, I would like to replace
with the Excel new line (code 10 - vbLf).
How can I do that?
I tried this:
sheet.add_row ['DESCRIPTION', strip_tags(@costproject.description).gsub!(" ", vbLf)]
Thanks for the help!
Try "\x0A". Something like:
sheet.add_row ['REVENUE DESCRIPTION', strip_tags(@costproject.revenue).gsub!(" ", "\x0A")]
That should be the Hex equivalent of vbLF. See this reference.
If you want both carriage return and line feed, use "\x0D\x0A".
Incidentally, I do not see any constant within Axlsx.