Click here to Skip to main content
15,891,657 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
Hi,

I am new to Ruby on rails and facing trouble in setting the column width of the table.

I am generating a word document (RoR app) where I have multiple tables and I use "com.lowagie.text.Table".

However, I am not able to change the width of the table column.
Posted

1 solution

Need some more details. According to your question I think you have to set the column length through model.

Let's say we have a model called customer.rb
and we have a column name "first_name" and we have to set its maximum length to 30 characters.

If the length exceed 30 characters then a error message should be shown.
So we have to do like this-
C#
validates :first_name, presence: { message: 'Please enter your First Name.'}
validates :first_name, :length => { :maximum => 30, :message => 'Please enter a First Name of 30 characters or less in length.' }


Hope this will help!! :)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900