Bug 63108

Summary: XSSFSheet.GetColumnWidth() return value is smaller than actual for default width column
Product: POI Reporter: linghao2000
Component: XSSFAssignee: POI Developers List <dev>
Status: NEW ---    
Severity: minor    
Priority: P2    
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: All   

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.