0

I'm currently working on the ruby on rails project which handles excel sheets.

I'm using RubyXL for it.

https://github.com/weshatheleopard/rubyXL

What I have no idea about it is how to shrink the texts to fit the cell.

I believe that this shrinkToFitenter image description here

will make it possible.

But I don't know how to call it.

Would anyone help me with this please?

Thank you so much for reading :)

1 Answers1

1
module RubyXL
    module CellConvenienceMethods
        def change_shrink_to_fix(shrink_to_fit = false)
            validate_worksheet
            self.style_index = workbook.modify_alignment(self.style_index) { |a| a.shrink_to_fit = shrink_to_fit }
        end
    end
end
tomerpacific
  • 4,704
  • 13
  • 34
  • 52
  • 1
    Remember that Stack Overflow isn't just intended to solve the immediate problem, but also to help future readers find solutions to similar problems, which requires understanding the underlying code. This is especially important for members of our community who are beginners, and not familiar with the syntax. Given that, **can you [edit] your answer to include an explanation of what you're doing** and why you believe it is the best approach? – Jeremy Caney Dec 24 '21 at 00:43