0

I'm using javabridge with php to create excel file using poi (org.apache.poi.hssf.usermodel.HSSFWorkbook class)

To set column width for default font (Arial 10) i calculate max length and use formula

strlen($string) * 256 that works fine

Since the first row is BOLD i have to change formula. A part of the title is hidden when this column has the max length.

Do I have to replace 256 by other value ?

I will use Arial 10 everywhere to make it easier

Ben
  • 188
  • 2
  • 16
  • In apache-poi, can't use access the column's `.EntireColumn.AutoFit` property? – Siddharth Rout Sep 21 '13 at 09:34
  • 1
    I found a link. see if [THIS](http://stackoverflow.com/questions/4611018/apache-poi-excel-how-to-configure-columns-to-be-expanded) is what you want? – Siddharth Rout Sep 21 '13 at 09:35
  • Is there a reason why you can't just use the built-in [Sheet.autosizeColumn method](http://poi.apache.org/apidocs/org/apache/poi/ss/usermodel/Sheet.html#autoSizeColumn%28int%29) ? – Gagravarr Sep 21 '13 at 10:30
  • yes ! cause after downloading the latest 3.10-beta2, call to $sheet->autoSizeColumn hangs web server and i have to stop / start apache. This method didn't exist in the release i used before that comes with javabridge – Ben Sep 21 '13 at 14:04
  • may be the answer here .. didn't try it .. too long to post http://mail-archives.apache.org/mod_mbox/poi-user/200801.mbox/%3C7814987.521200446599084.JavaMail.SYSTEM@sm2%3E – Ben Sep 22 '13 at 20:10
  • and may be here http://apache-poi.1045710.n5.nabble.com/HSSFSheet-autoSizeColumn-method-doesn-t-work-properly-on-Linux-system-td4270552.html it needs .ttf files that are not included in jre or jdk under solaris and i cannot find them – Ben Sep 22 '13 at 21:58

0 Answers0