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

            Bug ID: 64494
           Summary: CellStyles propagate unexpectedly and incorrectly
           Product: POI
           Version: unspecified
          Hardware: PC
            Status: NEW
          Severity: normal
          Priority: P2
         Component: XSSF
          Assignee: dev@poi.apache.org
          Reporter: marco.bariga...@gmail.com
  Target Milestone: ---

Hello, in the context of XSSF CellStyles this happens. If I write this very
simple code:

XSSFCellStyle styleRight = workbook.createCellStyle();
XSSFCellStyle styleLeft = workbook.createCellStyle();
styleRight.setAlignment(HorizontalAlignment.RIGHT);
styleLeft.setAlignment(HorizontalAlignment.LEFT);

The cells that have their style set to styleLeft will also, incorrectly, be
aligned to the right. 

If there is any other command that acts on either one of these styles, say for
example a setFont or setDataFormat, at any other point in the code, the cells
that have their style set to styleLeft will correctly be aligned to the left.

If BOTH styles have a, say, setFont applied to them, and the font put as
argument is the same object for both styles, the alignment will break again and
the supposedly left-aligned cells will align right (this doesn't happen if two
identical objects are set as the setFont arguments in either style).

If the order in which the objects are created flips (so styleLeft is created
before styleRight), so does the alignment (both will be aligned left). This
applies also for >2 styles, the first style created will propagate to all the
following ones.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@poi.apache.org
For additional commands, e-mail: dev-h...@poi.apache.org

Reply via email to