Bug 63108 - XSSFSheet.GetColumnWidth() return value is smaller than actual for default width column
Summary: XSSFSheet.GetColumnWidth() return value is smaller than actual for default wi...
Status: NEW
Alias: None
Product: POI
Classification: Unclassified
Component: XSSF (show other bugs)
Version: unspecified
Hardware: PC All
: P2 minor (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-01-24 07:16 UTC by linghao2000
Modified: 2019-02-17 06:59 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description linghao2000 2019-01-24 07:16:09 UTC
getColumnWidth()'s comment says "returned  value is always gerater that getDefaultColumnWidth() because the latter does not include margins". But if one  column keep default, getColumnWidth() will just call getDefaultColumnWidth() and return, no more margin or padding pixels added. So the returned value is always 8*256=2048, smaller than actual value.


   public int getColumnWidth(int columnIndex) {
        CTCol col = columnHelper.getColumn(columnIndex, false);
        double width = col == null || !col.isSetWidth() ? getDefaultColumnWidth() : col.getWidth();
        return (int)(width*256);
    }

I think we should add some extra width after call getDefaultColumnWidth(), but don't know how to calculate that.