简体   繁体   中英

rails axlsx format table header diagonally

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!

在此处输入图片说明

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)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM