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 2015/03/14 20:37:08 UTC

[Bug 56295] Cell styles are not copied from one workbook to another

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

Dominik Stadler <do...@gmx.at> changed:

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

--- Comment #9 from Dominik Stadler <do...@gmx.at> ---
This was caused by a combination of two bugs in POI and one in your code:
* POI did not handle the absence of the XML attribute "applyFill" as default
"true", but it seems Excel and LibreOffice do although I could not find any
answer for this in the Ecma spec 
* POI: When cloning styles, the Fills were not cloned over correctly
* Your code did not correctly create the new style, but somehow relied on a
style being availabe, which did not work correctly, 

Updating to a build of rr1666736 or newer and adjusting the cloning of the
style in your code as follows did make the sample work for me:

        //newCell.getCellStyle().cloneStyleFrom(oldCell.getCellStyle());
        CellStyle newCellStyle =
newCell.getRow().getSheet().getWorkbook().createCellStyle();
        newCellStyle.cloneStyleFrom(oldCell.getCellStyle());
        newCell.setCellStyle(newCellStyle);

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