summaryrefslogtreecommitdiffhomepage
path: root/examples/wrap_text_example.md
blob: caa75b179f714243ad0adf5ce651df7a6eb42e49 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
## Description

Set text wrapping from the styles

## Code

```ruby
require 'axlsx'

p = Axlsx::Package.new
wb = p.workbook
s = wb.styles

wrap_text = s.add_style alignment: { wrap_text: true }

wb.add_worksheet(name: 'Wrap Text') do |sheet|
  sheet.add_row ['First, Second and Third'], style: wrap_text
  sheet.column_widths 9
end

p.serialize 'wrap_text_example.xlsx'
```

## Output

![Output](images/wrap_text_example.png "Output")