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

            Bug ID: 65595
           Summary: [PATCH] Strip colour formatting in headers and footers
                    created by Excel
           Product: POI
           Version: 5.0.x-dev
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: XSSF
          Assignee: dev@poi.apache.org
          Reporter: viru.gajanay...@yahoo.com
  Target Milestone: ---

Excel allows the colour of header and footer text to be 
specified. A header displaying "test test test" with the
middle "test" in red will be stored as follows:
test &KFF0000test&K01+000 test

org.apache.poi.hssf.usermodel.HeaderFooter.stripFields() removes 
formatting tags from headers and footers, but this is missed.

This patch removes these colour formatting tags by adding the 
following new regexes after the existing ones
        text = text.replaceAll("\\&K[\\dA-F]{6}", "");
        text = text.replaceAll("\\&K[\\d]{2}[+][\\d]{3}", "");

An example of an Excel file with this an other formatting is 
used for a unit test

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