Bug 65331 - XWPFTable.setTableAlignment(TableRowAlign tra) wrong implementation (mapping between Enums)
Summary: XWPFTable.setTableAlignment(TableRowAlign tra) wrong implementation (mapping ...
Status: NEW
Alias: None
Product: POI
Classification: Unclassified
Component: XWPF (show other bugs)
Version: 5.0.0-FINAL
Hardware: PC All
: P2 major (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-05-25 18:51 UTC by Krzysztof Szymko
Modified: 2021-05-27 02:56 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Krzysztof Szymko 2021-05-25 18:51:29 UTC
Wrong mapping of TableRowAlign LEFT(1), CENTER(2), RIGHT(3) into 
org.openxmlformats.schemas.wordprocessingml.x2006.main.STJcTable    
CENTER = 1; END = 2; LEFT = 3; RIGHT = 4; START = 5; leads to setting wrong
value for alignment of table in the document.
  
    // 1 = TableRowAlign.LEFT => center
    // 2 = TableRowAlign.CENTER => end
    // 3 = TableRowAlign.RIGHT => left
    // 4 => right
    // 5 => start

public void setTableAlignment(TableRowAlign tra) {
    CTTblPr tPr = getTblPr(true);
    CTJcTable jc = tPr.isSetJc() ? tPr.getJc() : tPr.addNewJc();
    jc.setVal(STJcTable.Enum.forInt(tra.getValue()));
}
Comment 1 Sayi 2021-05-27 02:56:41 UTC
Thanks, the issue is fixed via r1890234, should be included in the upcoming Apache POI 5.0.1.