5

I am generating a spreadsheet using: Rails 3.2.12 with the axlsx gem (version 2.0.0)

There are cells which I want to have the text wrap and the height of the row adjust to match. This works when I use the following:

p = Axlsx::Package.new
wb = p.workbook

wb.styles do |s|
  wrap_text = s.add_style alignment: { wrap_text: true }
      wb.add_worksheet(name: "Sheet1") do |sheet|
        sheet.add_row [variable_containing_long_text], style: wrap_text

However, if I then merge that cell with others: Example sheet.merge_cells("A14:C14") the row height no longer auto-fits the contents.

How do I get the auto-height for the row based on contents after merging the cells?

Syntch
  • 51
  • 1
  • 3
  • How exactly are you generating this spreadsheet. Have you considered any alternatives? – Deej Oct 27 '13 at 23:18
  • Updated question with versions of rails and axlsx gem that I'm using. I originally started out using Excel XML format, but Excel never opened it without a warning so I switched to axlsx. – Syntch Oct 27 '13 at 23:30
  • I am not a heavy user of this gem but have found open issues for this: https://github.com/randym/axlsx/issues/69 and here also https://github.com/randym/axlsx/issues/125 – Deej Oct 28 '13 at 00:06
  • 1
    It appears to be an Excel issue. http://answers.microsoft.com/en-us/office/forum/office_2007-excel/autofit-row-height-doesnt-work/ca2a86b8-585a-46fd-a8a7-377e76ac5528?msgId=38709b42-daa4-4739-ae8c-ab8dcf2e2f0c – Syntch Oct 28 '13 at 17:44

0 Answers0