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 2016/06/15 11:45:29 UTC

[Bug 59705] New: Wrong implementation of XSSFPivotTable.addColumnLabel() methods

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

            Bug ID: 59705
           Summary: Wrong implementation of
                    XSSFPivotTable.addColumnLabel() methods
           Product: POI
           Version: 3.14-FINAL
          Hardware: PC
            Status: NEW
          Severity: blocker
          Priority: P2
         Component: XSSF
          Assignee: dev@poi.apache.org
          Reporter: chennak.s@intellicus.com

Created attachment 33950
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=33950&action=edit
pivot table

Implementation for XSSFPivotTable.addColumnLabel() method was wrong. 

Implementation provided for XSSFPivotTable.addColumnLabel() methods is actually
the implementation for ValueLabel() methods.

If we are creating pivot tables using XSSFPivotTable.addColumnLabel(), the
field is adding to the Values position in the excel file.

-- 
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 59705] Wrong implementation of XSSFPivotTable.addColumnLabel() methods

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

--- Comment #2 from Chenna Kesavarao <ch...@intellicus.com> ---
@Apache POI developers

Please verify it and resolve the ticket

-- 
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 59705] Wrong implementation of XSSFPivotTable.addColumnLabel() methods

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

--- Comment #4 from Javen O'Neal <on...@apache.org> ---
Thanks for your contribution!

Any chance you could also write a unit test for this so that behavior can be
verified in our automated builds?
Probably the best place to add the unit test would be here:
https://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFPivotTable.java?view=log

-- 
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 59705] Wrong implementation of XSSFPivotTable.addColumnLabel() methods

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

Javen O'Neal <on...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |NEEDINFO

-- 
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 59705] Wrong implementation of XSSFPivotTable.addColumnLabel() methods

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

--- Comment #3 from Chenna Kesavarao <ch...@intellicus.com> ---
Also please provide the provision to user to apply sorting on row label(s)
and/or column label(s)

-- 
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 59705] Wrong implementation of XSSFPivotTable.addColumnLabel() methods

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

--- Comment #1 from Chenna Kesavarao <ch...@intellicus.com> ---
i have updated code accordingly to fix this issue.

i have created a new method XSSFPivotTable.addColumnLabel(int columnIndex) and
changed the names of existing XSSFPivotTable.addColumnLabel() methods to
XSSFPivotTable.addValueLabel()

--------------------------------------------
New method, which i have added
---------------------------------------
  /**
     * Add a column label using data from the given column.
     * @param columnIndex the index of the column to be used as column label.
     */
    @Beta
    public void addColumnLabel(int columnIndex) {
        AreaReference pivotArea = getPivotArea();
        int lastRowIndex = pivotArea.getLastCell().getRow() -
pivotArea.getFirstCell().getRow();
        int lastColIndex = pivotArea.getLastCell().getCol() -
pivotArea.getFirstCell().getCol();

        if(columnIndex > lastColIndex) {
            throw new IndexOutOfBoundsException();
        }
        CTPivotFields pivotFields = pivotTableDefinition.getPivotFields();

        CTPivotField pivotField = CTPivotField.Factory.newInstance();
        CTItems items = pivotField.addNewItems();

        pivotField.setAxis(STAxis.AXIS_COL);
        pivotField.setShowAll(false);
        for(int i = 0; i <= lastRowIndex; i++) {
            items.addNewItem().setT(STItemType.DEFAULT);
        }
        items.setCount(items.sizeOfItemArray());
        pivotFields.setPivotFieldArray(columnIndex, pivotField);

        CTColFields colFields;
        if(pivotTableDefinition.getColFields() != null) {
            colFields = pivotTableDefinition.getColFields();
        } else {
            colFields = pivotTableDefinition.addNewColFields();
        }

        colFields.addNewField().setX(columnIndex);
        colFields.setCount(colFields.sizeOfFieldArray());
    }



--------------------------------------------------
Change of previous existing XSSFPivotTable.addColumnLabel methods to
XSSFPivotTable.addValueLabel
-----------------------------------------------------

-- 
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 59705] Wrong implementation of XSSFPivotTable.addColumnLabel() methods

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

Chenna Kesavarao <ch...@intellicus.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 OS|                            |All

-- 
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 59705] Wrong implementation of XSSFPivotTable.addColumnLabel() methods

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

Javen O'Neal <on...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |datasurfer@gmail.com

--- Comment #5 from Javen O'Neal <on...@apache.org> ---
*** Bug 59368 has been marked as a duplicate of this bug. ***

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