Android POI : Crash When Using AutoSizeColumn()
autoSizeColumn method of POI throws an exception that I didn't manage to resolve : 'java.lang.ClassNotFoundException: Didn't find class 'java.awt.font.FontRenderContext' on path:.
Solution 1:
You have tagged this android. On android, most (all?) AWT classes are not available. But POI needs a FontRenderContext
to calculate column sizes.
As a workaround, replace your call to autoSizeColumn(2)
by setColumnWidth(2, width)
. A approximate value for width
can be calculated by counting the maximum number of characters displayed in that column by a factor. Start by trying a value of about 0.55 * fontSizeInPoints
for proportional fonts.
PS: Next time please provide a complete stack trace and mention the JDK and POI versions that you use.
Post a Comment for "Android POI : Crash When Using AutoSizeColumn()"