Method: Writeexcel::Worksheet#set_v_pagebreaks
- Defined in:
- lib/writeexcel/worksheet.rb
#set_v_pagebreaks(breaks) ⇒ Object
Store the vertical page breaks on a worksheet. breaks is Fixnum or Array of Fixnum.
Add vertical page breaks to a worksheet. A page break causes all the data that follows it to be printed on the next page. Vertical page breaks act between columns. To create a page break between columns 20 and 21 you must specify the break at column 21. However in zero index notation this is actually column 20. So you can pretend for a small while that you are using 1 index notation:
worksheet1.set_v_pagebreaks(20) # Break between column 20 and 21
The set_v_pagebreaks() method will accept a list of page breaks and you can call it more than once:
worksheet2.set_v_pagebreaks([ 20, 40, 60, 80, 100]) # Add breaks
worksheet2.set_v_pagebreaks([120, 140, 160, 180, 200]) # Add some more
Note: If you specify the “fit to page” option via the fit_to_pages() method it will override all manual page breaks.
2021 2022 2023 |
# File 'lib/writeexcel/worksheet.rb', line 2021 def set_v_pagebreaks(breaks) @vbreaks += breaks.respond_to?(:to_ary) ? breaks : [breaks] end |