https://bz.apache.org/bugzilla/show_bug.cgi?id=60845
--- Comment #9 from [email protected] --- Okay, I again looked at the code and problem I described at first is caused by the following thing: cloneStyleFrom adds the styles from the original to the destination like that: --- CTFill fill = CTFill.Factory.parse( src.getCTFill().toString(), DEFAULT_XML_OPTIONS ); addFill(fill); --- I dont't know why, but that results in the following CTFill-String: <xml-fragment xmlns:main="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:x14ac="http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac" xmlns:x16r2="http://schemas.microsoft.com/office/spreadsheetml/2015/02/main"> <main:patternFill patternType="none"/> </xml-fragment> which is definitely not the same as <patternFill patternType="none" xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:x14ac="http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac" xmlns:x16r2="http://schemas.microsoft.com/office/spreadsheetml/2015/02/main"/> at least not syntactically. --- addFill (StylesTable.java) now looks if the new FillStyle is already in the Set by fills.indexOf(newFill). indexOf is based on equals of XSSFCellFill, which does a string-Comparison! --- One way to patch that would be to change the equals function to a semantic comparison like: public boolean equals(Object o) { if (!(o instanceof XSSFCellFill)) return false; XSSFCellFill cf = (XSSFCellFill) o; return ( this.getFillBackgroundColor() == cf.getFillBackgroundColor() && this.getFillForegroundColor() == cf.getFillForegroundColor() && this.getPatternType() == cf.getPatternType() ); } The downside is the deteriorated performance I guess. And you have to do the same on XSSFFont.java and XSSFCellBorder.java (and maybe more). --- Another way is to convert the "fragments" into normal XML inside cloneStyleFrom(), I am still looking for a way to do that reliable (using xmlbeans). -- You are receiving this mail because: You are the assignee for the bug. --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
