Skip to content

Instantly share code, notes, and snippets.

@jhjguxin
Forked from niallsmart/linebreak.rb
Created October 27, 2015 07:18
Show Gist options
  • Save jhjguxin/2fc8458db68dee069099 to your computer and use it in GitHub Desktop.
Save jhjguxin/2fc8458db68dee069099 to your computer and use it in GitHub Desktop.
Axlsx line break
require 'axlsx'
Axlsx::Package.new do |package|
workbook = package.workbook
workbook.add_worksheet do |sheet|
wrap = workbook.styles.add_style alignment: {wrap_text: true}
sheet.add_row ["Foo\r\nBar", "Foo\rBar", "Foo\nBar", "Foo\n\r\nBar"], style: wrap
end
package.serialize "linebreak.xlsx"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment