• Post Reply Bookmark Topic Watch Topic
  • New Topic

AutoFit Row height in excel using POI Api

 
Bratati Deb Roy
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I wanted to know whether there is a way to autofit the height of a row in an excel which is generated using POI Api. I want to do it in the code itself.
 
Sivaraman Lakshmanan
Ranch Hand
Posts: 231
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am also facing the exact problem. Could someone please help
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What do you mean by "autofit"? Fit to what?
 
Sivaraman Lakshmanan
Ranch Hand
Posts: 231
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ulf,
Autofit of rows is that the height of the rows automatically aligns his height to the heighest cell height of thta row. If you wrap the cell which has a long string, the height of the cell becomes more due to warpping, here I want the height of the row to align the height of the cell.

When you create a Excel sheet using MSExcel, the height of the rows are automaticlly set to the height of the heighest cell but when you write the same excel sheet using POI, the row height is set to default value(-3678, I guess) if you do not specify, so when we copy the sheet to another sheet using JXLS API, since the row height is set to a negative value, the height of the rows becomes very large. Is there any way to find the height of the heighest cell and set that value to the row height as MSExcel does.

Any help on this is very much appreciated.
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I doubt there is a way to do this. POI and jExcelApi are APIs to read, alter and write XLS files. They're not meant to duplicate Excel functionality.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!