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 2009/11/01 11:51:11 UTC

DO NOT REPLY [Bug 46938] Existing color palette is broken(or not used) when using cell styles from opened workbook and creating new

https://issues.apache.org/bugzilla/show_bug.cgi?id=46938

Karl Eilebrecht <Ka...@freenet.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
            Version|3.2-FINAL                   |3.5-FINAL
         Resolution|WONTFIX                     |

--- Comment #9 from Karl Eilebrecht <Ka...@freenet.de> 2009-11-01 02:51:05 UTC ---
Hi, 
I ran into the same problem and must agree with the previous speakers, this
"bug" is an unsupported behaviour of Excel 2007, not an error of POI.

However, the situation is extremely disappointing for me, since I'll have to
support Excel 2007 for editing templates - and colors are very important for
some customers.

After a weekend of tracing the serialization of records and trial+error I tried
the following hack:

using POI 3.5-FINAL
Workbook.class, line 812
public ExtendedFormatRecord createCellXF() {
    int insertPos = records.getXfpos() + 1;
    if (insertPos < records.size()) {
        while (records.get(insertPos) instanceof UnknownRecord) {
            insertPos++;
            if (insertPos == records.size()) {
                break;
            }
        }
    }
    records.add(insertPos, xf);
    records.setXfpos( insertPos );
    numxfs++;
    return xf;
}

Obviously this is rather a hack than a solution. It seems(!) to help.
And if so, this workaround could be useful for many people using POI.

I'd be pleased if some of the gurus could check if this "happy reordering" is
in conflict with any known rule of the excel format and thus may be
discouraged.
Especially testing with different excel versions (I only have 2007) would be
important.

Thanks!

Regards.
Karl

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- 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