大虾使用rails时如何设置table的column_width?
这是我的大虾代码
table1 = [["Time duration selected", "Driving Time", "Stop Time", "Productivity", "Stop Count", "Max Speed (km/h)", "Average Speed (km/h)", "Distance Travelled (km)"]]
table(table1)
这段代码创建了一行..但是我需要在这里指定列宽...那么如何设置列宽呢?
This is my prawn code
table1 = [["Time duration selected", "Driving Time", "Stop Time", "Productivity", "Stop Count", "Max Speed (km/h)", "Average Speed (km/h)", "Distance Travelled (km)"]]
table(table1)
This code creates a row.. But i need to specify column width here... so how to set the column width?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
可以通过两种方式提及宽度。
首先,
table 表名,:column_widths => {0 =>; 70,1=> 60,2=> 60,3=> 60,4=> 60,5=> 70,6=> 70,7=> 70}
该表包含 8 列。
其次,你设置整个表格的宽度
table tablename,:width => 350
Two ways width can be mentioned.
First,
table tablename,:column_widths => {0 => 70,1 => 60,2 => 60,3 => 60,4 => 60,5 => 70,6 => 70,7 => 70}
This table contains 8 columns.
Secondly, you set the width of the whole table
table tablename,:width => 350