Skip to content

[Enhancement] Add option to choose alternate JAXB implementation for docx4j to support Google Docs documents #123

@ZuhaibT

Description

@ZuhaibT

Some .docx files exported from Google Docs contain decimal values for page margins, which the current JAXB implementation used by docx4j does not support. As a result, these documents fail to load or process correctly in Faction.
To address this, I propose adding a configuration option that allows users to select a different JAXB implementation that can parse decimal margin values.

Context / Problem

Google Docs exports .docx files where page margin values are represented with decimal numbers (e.g., 72.5).

The default JAXB implementation currently bundled with docx4j (and used by Faction) cannot parse these decimal values, leading to parsing errors. This prevents users from reliably using Google Docs–generated .docx files as report templates without conversion or manual editing.

Proposed Solution

Introduce a build/profile option that lets users choose an alternate JAXB implementation for docx4j.

  • Add a Maven build profile or configuration flag that lets users switch between supported JAXB providers.
  • Update the pom.xml to include optional dependencies for alternate JAXB implementations — for example, EclipseLink MOXy and others that docx4j supports. docx4j already provides artifacts for different JAXB providers (e.g., docx4j-JAXB-MOXy, docx4j-JAXB-ReferenceImpl), and only one should be enabled at a time.
  • When the profile is activated (e.g., -P use-moxy), docx4j will use that JAXB provider at runtime.

Updates required to use EclipseLink MOXy: 6fbb5cf

This gives users flexibility to choose a JAXB provider that can parse decimal margin values without breaking existing workflows.

Benefits

  • Improves .docx compatibility, especially for files created in Google Docs.
  • Prevents unnecessary manual document cleanup or conversion steps.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions