سؤال

I am using the ruby on rails axlsx gem to render my excel. Now I want to style the text so that it shows up diagonally as shown in the sample image attached. I am not sure where or how to set this alignment feature in the code. Any help is appreciated!

enter image description here

هل كانت مفيدة؟

المحلول

alignment: {:textRotation => 60}

That did it for me. I managed to find a similar issue from the axlsx github page: https://github.com/randym/axlsx/issues/110

I wasn't able to locate it in the docs.

The complete code can be implemented as follows:

my_style {
alignment: {:textRotation => 60, horizontal: :center, vertical: :center, wrap_text: true},
}
sheet.add_row(headers, style: styles[:my_style], height: height)
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top