Apache POI autoSizeColumn Resizes Incorrectly

前端 未结 8 964
小鲜肉
小鲜肉 2020-11-29 06:27

I\'m using Apache POI in java to create an excel file. I fill in the data then try to autosize each column, however the sizes are always wrong (and I think consiste

8条回答
  •  遥遥无期
    2020-11-29 07:10

    I had a similar issue on Windows 7.

    I was using the Calibri font (that is supported in my JVM). With that font the getBounds().getWidth() of the java.awt.font.TextLayout used by the autoSizeColumn() POI method returns 0.

    Changing the font to Calibri-Regular solved the issue in my case.

提交回复
热议问题