Reputation: 7953
I have width of the column value as a percentage and I want to convert the same to excel width to set the width of the column. How do we do this in java, based on what the column width is calculated in excel.?
I use the following:
HSSFSheet sheet = hwb.createSheet(reportName);
sheet.setColumnWidth((short)columnIterator, (short)6000);
In this method, the first argument is the column id and the second one is the width of the column. I want to set this width dynamically using the html width.
Example:
If the the column width in html is 10% then what is the equelant width in excel width.? I want to set the column width of excel dynamically like setAutoColumnwidth().
UPDATE :
i found this, is this correct.
Regards,
Upvotes: 1
Views: 1676
Reputation: 1943
http://poi.apache.org/apidocs/org/apache/poi/hssf/usermodel/HSSFSheet.html#autoSizeColumn%28int%29
Does this do what you want?
Upvotes: 1