Skip to content

Instantly share code, notes, and snippets.

@pullmonkey
Created April 26, 2012 19:03
Show Gist options
  • Select an option

  • Save pullmonkey/2502027 to your computer and use it in GitHub Desktop.

Select an option

Save pullmonkey/2502027 to your computer and use it in GitHub Desktop.
Spreadsheet gem add header to every page
module Spreadsheet
module Excel
module Writer
class Worksheet
alias_method :write_from_scratch_without_header, :write_from_scratch
def write_header
write_op opcode(:header), [@worksheet.header.bytesize, 0].pack("vC"), @worksheet.header
end
def write_from_scratch
write_header
write_from_scratch_without_header
end
end
end
end
class Worksheet
attr_accessor :header
def add_header(str)
@header = str
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment