You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by bu...@apache.org on 2011/11/15 12:14:02 UTC

DO NOT REPLY [Bug 52186] New: groupColumn with setColumnWidth not working

https://issues.apache.org/bugzilla/show_bug.cgi?id=52186

             Bug #: 52186
           Summary: groupColumn with setColumnWidth not working
           Product: POI
           Version: unspecified
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P2
         Component: SXSSF
        AssignedTo: dev@poi.apache.org
        ReportedBy: alesya.strokina@gersis-software.com
    Classification: Unclassified


Created attachment 27938
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=27938
test and xlsx-file with unsuccessful column group

If we set the width of the columns and add group on the columns, the columns do
not appear. 

Attachment contains a file with a test that generates xlsx-file with
unsuccessful group and generated file.

Included libraries:
•    poi-3.8-beta4-20110826.jar 
•    poi-examples-3.8-beta4-20110826.jar 
•    poi-excelant-3.8-beta4-20110826.jar 
•    poi-ooxml-3.8-beta4-20110826.jar 
•    poi-ooxml-schemas-3.8-beta4-20110826.jar 
•    poi-scratchpad-3.8-beta4-20110826.jar

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 52186] groupColumn with setColumnWidth not working

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=52186

vladk <vl...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |vladk.dev@gmail.com

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 52186] groupColumn with setColumnWidth not working

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=52186

vladk <vl...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|SXSSF                       |XSSF
            Version|unspecified                 |3.9
                 OS|Windows XP                  |Windows 7
           Severity|normal                      |major

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 52186] groupColumn with setColumnWidth not working

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=52186

--- Comment #5 from vladk <vl...@gmail.com> ---
Created attachment 30563
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=30563&action=edit
Patch to set column width when grouping columns

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 52186] groupColumn with setColumnWidth not working

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=52186

--- Comment #2 from vladk <vl...@gmail.com> ---
It appears that Excel 2010 doesn't like column definitions with undefined
"width" attribute like follows:
<cols>
    <col min="5" max="5" width="20.0" customWidth="true" collapsed="false"
outlineLevel="1"/>
    <col min="6" max="8" collapsed="false" outlineLevel="1"/>
</cols>

The Excel 2010 would create the following column configuration:
<cols>
    <col min="5" max="5" width="20.0" customWidth="1" outlineLevel="1"/>
    <col min="6" max="8" width="11.42578125" customWidth="1" outlineLevel="1"/>
</cols>
whereas width="11.42578125" seems to be the default width for my system.

According to the specification width is an optional attribute with unspecified
default value: http://www.schemacentral.com/sc/ooxml/e-ssml_col-1.html


The mentioned column configuration was produced by the following code:
    sheet1.setColumnWidth(4, 20*256);
    sheet1.groupColumn( (short)4, (short)7 );


A workaround is to set explicit width for all grouped columns after the
grouping:
    sheet1.setColumnWidth(4, 20*256);
    sheet1.groupColumn( (short)4, (short)7 );
    sheet1.setColumnWidth(5, sheet1.getDefaultColumnWidth() * 256);
    sheet1.setColumnWidth(6, sheet1.getDefaultColumnWidth() * 256);
    sheet1.setColumnWidth(7, sheet1.getDefaultColumnWidth() * 256);

Does anyone have an idea what where the proper class/method to modify POI to
make it setting "width" attribute always?

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 52186] groupColumn with setColumnWidth not working

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=52186

Tim Allison <ta...@mitre.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #6 from Tim Allison <ta...@mitre.org> ---
Should be fixed as of r1510587.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 52186] groupColumn with setColumnWidth not working

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=52186

--- Comment #3 from Nick Burch <ap...@gagravarr.org> ---
In Excel, if you group the columns, does it auto-calculate the width for you? 

(I'm just wondering if we can safely just read the widths of the columns to be
grouped to set the overall grouping width, or if we'd need to do an
auto-calculation first)

As for where to put the code, search for CTCols and CTCol, those should be the
names of the xmlbeans classes for <cols> and <col> - any width setting code
will want to go with/near similar modifications of those beans.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 52186] groupColumn with setColumnWidth not working

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=52186

vladk <vl...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Version|3.9                         |3.10-dev

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 52186] groupColumn with setColumnWidth not working

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=52186

--- Comment #4 from vladk <vl...@gmail.com> ---
Excel 2010 creates <cols> tag with the following content for:

- Excel sheet with one column having custom width
<cols>
    <col min="2" max="2" width="26.625" customWidth="1"/>
</cols>

- Excel sheet with one column having custom width. The column is part of a
column group "2..4". The column group is expanded.
<cols>
    <col min="2" max="2" width="26.625" customWidth="1" outlineLevel="1"/>
    <col min="3" max="4" width="11" outlineLevel="1"/>
</cols>

- Excel sheet with one column having custom width. The column is part of a
column group "2..4". The column group is collapsed.
<cols>
    <col min="2" max="2" width="26.625" hidden="1" customWidth="1"
outlineLevel="1"/>
    <col min="3" max="4" width="0" hidden="1" customWidth="1"
outlineLevel="1"/>
    <col min="5" max="5" width="11" collapsed="1"/>
</cols>

Excel 2010 never omits the "width" attribute in <col> tags. If the column width
is not defined explicitly, it takes "0" for hidden columns and "11" for visible
ones. "11" appears to be the default width. To behave like Excel 2010, the POI
has to set "width" attribute whenever it creates a <col> tag.

By the way, Excel 2010 and POI have different default widths: Excel 2010 -
"11", POI - "8". Why "8"? May the XSSFSheet.getDefaultColumnWidth() method be
modified, to return 11 instead of 8?

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 52186] groupColumn with setColumnWidth not working

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=52186

--- Comment #1 from vladk <vl...@gmail.com> ---
I can confirm the problem is still present in POI 3.9. Below is the simplest
client to reproduce the problem:

        Workbook wb = new XSSFWorkbook();
        Sheet sheet1 = wb.createSheet("new sheet");

        sheet1.setColumnWidth(4, 5000);
        sheet1.setColumnWidth(5, 5000);

        sheet1.groupColumn((short) 4, (short) 7);
        sheet1.groupColumn((short) 9, (short) 12);

        FileOutputStream fileOut = new FileOutputStream("outlining.xlsx");
        wb.write(fileOut);
        fileOut.close();

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org