This week's book giveaway is in the Jython/Python forum.
We're giving away four copies of Murach's Python Programming and have Michael Urban and Joel Murach on-line!
See this thread for details.
Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How to set the cell size with PdfPCell object in the table?  RSS feed

 
Simpson Kumar
Ranch Hand
Posts: 261
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I would like to set the size to the cell like in HTML as follows


In my PDF code, we used the following code to set the cell for the table


I didn't find any method to set the size of the cell.
please some one give me the suggestion on this.
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can't change the width of individual cells, only of a complete column. The PdfPtable class has the setWidths method for that, or you can use the PdfPTable(float[] relativeWidths) constructor.
 
Simpson Kumar
Ranch Hand
Posts: 261
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
so, in the Java PDF we can't set the size to the cells, i.e. if the table width is 600 like , then the three cells equally shares the size? I think it doesn't make sence.. but I need to maintain three cells in different sizes as I mentioned in the query. what can I do?
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The two methods I mentioned let you set different widths for each column, while setTotalWidth sets the width of the table itself. Why do you think that doesn't make sense?
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!