blob: c2e1aeb5b3110b4eb8c1eebe3ef239b9df035c7b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
$LOAD_PATH.unshift "#{File.dirname(__FILE__)}/../lib"
require 'axlsx'
p = Axlsx::Package.new
p.workbook do |wb|
wb.styles do |s|
wrap_text = s.add_style :fg_color=> "FFFFFF",
:b => true,
:bg_color => "004586",
:sz => 12,
:border => { :style => :thin, :color => "00" },
:alignment => { :horizontal => :center,
:vertical => :center ,
:wrap_text => true}
wb.add_worksheet(:name => 'wrap text') do |sheet|
sheet.add_row ['Torp, White and Cronin'], :style => wrap_text
# Forcing the column to be a bit narrow so we can see if the text wrap.
sheet.column_info.first.width = 5
end
end
end
p.serialize 'wrap_text.xlsx'
|