zealmurugan
zealmurugan

Reputation: 329

How to set the column_width for table while using rails prawn?

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?

Upvotes: 3

Views: 3811

Answers (1)

zealmurugan
zealmurugan

Reputation: 329

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

Upvotes: 11

Related Questions