randym / axlsx

xlsx generation with charts, images, automated column width, customizable styles and full schema validation. Axlsx excels at helping you generate beautiful Office Open XML Spreadsheet documents without having to understand the entire ECMA specification. Check out the README for some examples of how easy it is. Best of all, you can validate your xlsx file before serialization so you know for sure that anything generated is going to load on your client's machine.
MIT License
2.62k stars 696 forks source link

Axlsx indent not working #661

Open BigMcLargeHuge opened 3 years ago

BigMcLargeHuge commented 3 years ago

I'm attempting to add an indent to a cell using Axlsx in a rails app but am apparently failing. From what I've read in the documentation and a few other pages this should be done in the following way.

@indent_1 = worksheet.styles.add_style :alignment => { :indent => 1 }

sheet.add_row ['pcd.1 - Dealer Support for Membership in Professional Design Organization'].concat([nil] * 6).concat([design_detail.maximum(:dealer_support_membership_metric).to_s.capitalize,
totals[:dealer_support_membership], nil,
scores[:dealer_support_membership], nil]),
style: @indent_1

However, no indent is appearing. I'm not quite clear on the units of the :indent integer but I've tried 1, 10, and 20 with no apparent difference.

I'm running rails 4.2.1 ruby 2.2.0 axlsx 1.3.6

remcode-remco commented 1 year ago

I assume you're not still looking for a solution to this, but in case anyone else is: you also need to specify horizonal alignment like so: :alignment => {:horizontal => :left, :indent => 1}