-
-
Save tmaeda/9830088 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#```ruby | |
require 'axlsx' | |
p = Axlsx::Package.new | |
wb = p.workbook | |
header = {:different_odd_ => false, :odd_header => "&L&F : &A&C&Pof&N&R&D &T"} | |
wb.add_worksheet(:name => "repeated header", :header_footer => header) do |sheet| | |
sheet.add_row %w(These Column Header Will Render On Every Printed Sheet) | |
200.times { sheet.add_row %w(1 2 3 4 5 6 7 8) } | |
# This is the magic | |
wb.add_defined_name("'repeated header'!$1:$1", :local_sheet_id => sheet.index, :name => '_xlnm.Print_Titles') | |
end | |
p.serialize 'repeating_headers.xlsx' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment