pjfanning commented on code in PR #829:
URL: https://github.com/apache/poi/pull/829#discussion_r2190839828


##########
poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/XWPFParagraph.java:
##########
@@ -506,13 +506,18 @@ public ParagraphAlignment getAlignment() {
      * specified in the style hierarchy, then no alignment is applied to the
      * paragraph.
      *
-     * @param align the paragraph alignment to apply to this paragraph.
+     * @param align the paragraph alignment to apply to this paragraph. It can
+     *              be null to unset it and fall back to the style hierarchy.
      */
     public void setAlignment(ParagraphAlignment align) {
         CTPPr pr = getCTPPr();
-        CTJc jc = pr.isSetJc() ? pr.getJc() : pr.addNewJc();
-        STJc.Enum en = STJc.Enum.forInt(align.getValue());
-        jc.setVal(en);
+        if (align == null) {
+            pr.unsetJc();

Review Comment:
   * is there some way that getCTPPr(init = false) could be used here? we have 
equivalent code elsewhere
   * we don't want to create a CTPPr instance if none already exists for the 
null input case



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@poi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@poi.apache.org
For additional commands, e-mail: dev-h...@poi.apache.org

Reply via email to