Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
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: 42967
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: 42967
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?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic