mercredi 6 mars 2019

How to create Header and footer using Axlsx Gem in Rails?

I am trying to create the header and footer with the below code in the rails. But it is not creating the header and footer in the Excel file. Where I did wrong?

     xlsx_package = Axlsx::Package.new
        wb = xlsx_package.workbook
        header_footer = {:different_first => false, odd_header:'&C&14 &B&UHeader Text', odd_footer:'&L&11&BPage &P &C&11Footer Text &R&11&ILast updated:&D'}
        wb.add_worksheet(name: "header footer", :header_footer => header_footer) do |sheet|
             sheet.add_row ["First Column", "Second", "Third"]
             sheet.add_row [1, 2, 3]
       end

Aucun commentaire:

Enregistrer un commentaire