Yoshihisa Okada
Yoshihisa Okada

Reputation: 33

Auto resizing of the font on RubyXL

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 :)

Upvotes: 0

Views: 299

Answers (1)

user17734517
user17734517

Reputation: 26

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

Upvotes: 1

Related Questions