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

            Bug ID: 69744
           Summary: XWPFTable.getTableAlignment throws
                    IllegalArgumentException
           Product: POI
           Version: 5.4.x-dev
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: XWPF
          Assignee: dev@poi.apache.org
          Reporter: jaragu...@igalia.com
  Target Milestone: ---

Created attachment 40071
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=40071&action=edit
Reproducer

The attached docx was created with Word 365, it contains a table aligned to the
right.

If we open the document with POI and call XWPFTable.getTableAlignment(), we get
an exception:

java.lang.IllegalArgumentException: Unknown table row alignment: 4
        at
org.apache.poi.ooxml/org.apache.poi.xwpf.usermodel.TableRowAlign.valueOf(TableRowAlign.java:52)
        at
org.apache.poi.ooxml/org.apache.poi.xwpf.usermodel.XWPFTable.getTableAlignment(XWPFTable.java:479)
        at
org.apache.poi.ooxml/org.apache.poi.xwpf.usermodel.TestXWPFTable.testTableRightAlign(TestXWPFTable.java:655)

The cause of the exception is the value of the right alignment in the table
XML:

    <w:trPr>
      <w:trHeight w:val="341" />
      <w:jc w:val="right" />
    </w:trPr>

POI expects the value "end", but it finds "right". The documents produced by
LibreOffice tend to use "start" and "end" but Word (at least the latest
version) uses "left" and "right", deviating from the OOXML spec.

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