Sign in or sign up before continuing. Don't have an account yet? Register now to get started.
Register now

Okapi merger does not recognise vanish=on/off set by Apache POI >= 5.x

Summary In the current versions of Apache POI (≥ 5.x), the vanish property is set to "on" or "off" when hiding table columns. This differs from earlier versions (≤ 4.1.2), where the same property was set to "true" or "false".

Okapi’s merger logic only recognises "true" and "false" as valid values for hidden content. As a result, tables or columns marked as hidden using newer versions of Apache POI are not correctly processed by Okapi steps like HideTablesInWordStep.

Technical Details

Apache POI 4.1.2:

vanish.setVal(value ? STOnOff.TRUE : STOnOff.FALSE); // yields "true"/"false"

Apache POI 5.2.5 and later:

vanish.setVal(value ? STOnOff1.ON : STOnOff1.OFF); // yields "on"/"off"

Okapi's merger logic expects "true"/"false":

https://gitlab.com/Unbabel-Okapi/okapi-fork/blob/0cf2c5d7e941de424fc0b5cf6c381cb121b2c792/okapi/filters/openxml/src/main/java/net/sf/okapi/filters/openxml/XMLEventHelpers.java#L87-87

Proposed Fix To restore compatibility with documents created using Apache POI 5.x, we extended the BooleanAttributeValue enum to support the new values:

enum BooleanAttributeValue {
    FALSE_INTEGER("0"),
    TRUE_INTEGER("1"),
    FALSE_STRING("false"),
    TRUE_STRING("true"),

    // Added for Apache POI 5.x compatibility
    ON_TRUE_STRING("on"),
    OFF_FALSE_STRING("off");
}

A patch file is attached:add-on-off-attr-value-to-XMLEventHelpers.patch

Edited Aug 07, 2025 by Anton Maeso
Assignee Loading
Time tracking Loading