0

Is there a way to add an image to a header footer using Axlsx?

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: "Sheet1",:header_footer => header_footer) do |sheet|
    #add rows, etc.
end

I'd like to add an image to the Right section of the header and all of the examples are to place the image in a particular cell.

Any ideas on how I can accomplish this?

amarcy
  • 1,485
  • 2
  • 19
  • 28
  • This does not address Axlsx, so it is not necessarily an answer, but will put a picture in the right pane of the header. Page Layout >> Margins >> Custom Margins >> Header/Footer >> Custom Header (or Footer) >> Right section >> Insert picture – Clif Dec 18 '14 at 17:00

1 Answers1

2

To answer your question "Is there a way to add an image to a header footer using Axlsx?" is currently No. The header_footer.rb file in the axlsx github repository has the options to include a string with control characters that allow to include author name, dates, page numbers, etc. It states - "Headers and footers are generated using a string which is a combination of plain text and control characters". Also, the header_footer object is serialized to xml_string for processing.

So far, the only way of adding images in a sheet is via add_image method.

Shifa Khan
  • 769
  • 6
  • 12
  • is there a way to add an image anywhere inan excel using `axlsx`? I have a table containing multiple dates (one date in each column) in an excel and I would like to draw an arrow pointing to one of the columns in the excel. Is there a way to do this? – Biju Feb 25 '19 at 12:26
  • This need not be an image - I just need to draw an arrow – Biju Feb 25 '19 at 12:26