summaryrefslogtreecommitdiffhomepage
path: root/examples/fit_to_page_example.md
blob: de02371c8109abe2b1a3c9afe7be46ecb5076237 (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
## Description

This is a very basic example with a worksheet and two rows of data.

## Code

```ruby
require 'axlsx'

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

wb.add_worksheet(name: 'Fit to page') do |sheet|
  sheet.add_row 'this all goes on one page'.split('')
  sheet.page_setup.fit_to width: 1, height: 1
end

p.serialize 'fit_to_page_example.xlsx'
```

## Output

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

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