简体   繁体   English

如何将HTML表格的列宽转换为Java中的Excel列宽

[英]how to convert the width of column of html table to the width of excel column in java

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. 我将列值的宽度表示为百分比,我想将其转换为excel width以设置列的宽度。 How do we do this in java, based on what the column width is calculated in excel.? 基于excel中计算的列宽,我们如何在java中做到这一点?

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. 在此方法中,第一个参数是列ID,第二个参数是列的宽度。 I want to set this width dynamically using the html width. 我想使用html宽度动态设置此宽度。

Example: 例:

If the the column width in html is 10% then what is the equelant width in excel width.? 如果html中的列宽是10%,那么excel宽度中的等宽是多少。 I want to set the column width of excel dynamically like setAutoColumnwidth(). 我想像setAutoColumnwidth()一样动态设置Excel的列宽。

UPDATE : 更新:

i found this , is this correct. 我发现这个 ,这是正确的。

Regards, 问候,

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM