diff options
| author | Stefan <[email protected]> | 2022-06-05 12:40:59 +0200 |
|---|---|---|
| committer | Stefan <[email protected]> | 2022-06-05 12:41:06 +0200 |
| commit | 5ae8ef157be8d57db45cd90313e3e54c3f91f063 (patch) | |
| tree | ea5f860c218d98310e14287b53a308a06367d408 /examples/set_print_area_example.md | |
| parent | b15ad45eb7a4d85a8693c1e31add85f7139c3cc8 (diff) | |
| download | caxlsx-5ae8ef157be8d57db45cd90313e3e54c3f91f063.tar.gz caxlsx-5ae8ef157be8d57db45cd90313e3e54c3f91f063.zip | |
Add example for defining print area (#134)
Diffstat (limited to 'examples/set_print_area_example.md')
| -rw-r--r-- | examples/set_print_area_example.md | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/examples/set_print_area_example.md b/examples/set_print_area_example.md new file mode 100644 index 00000000..69d0b20e --- /dev/null +++ b/examples/set_print_area_example.md @@ -0,0 +1,28 @@ +## Description + +Change the range of cells that will be printed out when the sheet is printed + +## Code + +```ruby +require 'axlsx' + +p = Axlsx::Package.new +wb = p.workbook + +wb.add_worksheet(name: 'PrintArea') do |sheet| + sheet.add_row ['this', 'fits', 'in', 'the', 'print', 'area', 'this does not'] + sheet.page_setup.fit_to width: 1, height: 1 + wb.add_defined_name("PrintArea!A1:F1", local_sheet_id: sheet.index, name: '_xlnm.Print_Area') +end + +p.serialize 'set_print_area_example.xlsx' +``` + +## Output + +How it looks in excel: + + +Print preview dialog: + |
