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 2018/09/19 16:05:57 UTC

[Bug 62740] New: XSSFTable constructor automatically assigns invalid (non-unique) column IDs

https://bz.apache.org/bugzilla/show_bug.cgi?id=62740

            Bug ID: 62740
           Summary: XSSFTable constructor automatically assigns invalid
                    (non-unique) column IDs
           Product: POI
           Version: 4.0.0-FINAL
          Hardware: PC
                OS: Mac OS X 10.1
            Status: NEW
          Severity: normal
          Priority: P2
         Component: XSSF
          Assignee: dev@poi.apache.org
          Reporter: afprusin@gmail.com
  Target Milestone: ---

By default, XSSFTableColumn IDs have the non-unique value of '1'.  This is
interpreted as an invalid table by Microsoft Office Excel.

The somewhat dated 'Create Table' example will reproduce this behavior:
(https://svn.apache.org/repos/asf/poi/trunk/src/examples/src/org/apache/poi/xssf/usermodel/examples/CreateTable.java)

When specifying a table and auto-generating the columns via a cell range, XML
similar to the following is produced (in 'table1.xml):

<?xml version="1.0" encoding="UTF-8"?>
<table id="1" ref="A1:C3" name="Test" displayName="Test_Table"
xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main"><tableColumns
count="3"><tableColumn id="1" name="Column1"/><tableColumn id="1"
name="Column2"/><tableColumn id="1"
name="Column3"/></tableColumns><tableStyleInfo name="TableStyleMedium2"
showRowStripes="true" showColumnStripes="true"/></table>

As can be seen, by default, all table columns are assigned a non-unique ID.

This behavior seems to stem from newly introduced logic (lines 285-293) in
XSSFTable.java

-- 
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 62740] XSSFTable constructor automatically assigns invalid (non-unique) column IDs

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

Greg Woolsey <gr...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
                 OS|Mac OS X 10.1               |All
           Hardware|PC                          |All
             Status|NEW                         |RESOLVED

--- Comment #3 from Greg Woolsey <gr...@gmail.com> ---
Fixed in r1841357.

-- 
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 62740] XSSFTable constructor automatically assigns invalid (non-unique) column IDs

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

PJ Fanning <fa...@yahoo.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Blocks|                            |62758
                 CC|                            |dmgauntt@uab.edu

--- Comment #5 from PJ Fanning <fa...@yahoo.com> ---
*** Bug 62758 has been marked as a duplicate of this bug. ***


Referenced Bugs:

https://bz.apache.org/bugzilla/show_bug.cgi?id=62758
[Bug 62758] createColumn corrupts XSSFTable
-- 
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 62740] XSSFTable constructor automatically assigns invalid (non-unique) column IDs

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

--- Comment #1 from Greg Woolsey <gr...@gmail.com> ---
Yep, looks to me like the logic should start with 0 instead of 1, then add 1
after the loop.

I'm working on this now (in case other devs see it too).

--- Comment #2 from Greg Woolsey <gr...@gmail.com> ---
Yep, looks to me like the logic should start with 0 instead of 1, then add 1
after the loop.

I'm working on this now (in case other devs see it too).

-- 
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


Re: [Bug 62740] XSSFTable constructor automatically assigns invalid (non-unique) column IDs

Posted by nanaki <jo...@laposte.net>.
The bug is in  public XSSFTableColumn createColumn(String columnName, int
columnIndex) function : 
  nextColumnId = Math.max(nextColumnId, tableColumn.getId());
should be : 
  nextColumnId = Math.max(nextColumnId, tableColumn.getId()) + 1;



--
Sent from: http://apache-poi.1045710.n5.nabble.com/POI-Dev-f2312866.html

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


[Bug 62740] XSSFTable constructor automatically assigns invalid (non-unique) column IDs

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

--- Comment #4 from Andrew Frank Prusinowski <af...@gmail.com> ---
Awesome; thanks for the good work :)

-- 
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