jaragunde commented on code in PR #829: URL: https://github.com/apache/poi/pull/829#discussion_r2195370571
########## 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: I added `getCTPPr(create)` in one of the patches I just uploaded, and I kept `getCTPPr()` with no arguments to call `getCTPPr(true)`, preserving the original behavior. I looked for similar implementations and found `XSLFPlaceholderDetails.getCTPlaceholder(create)`, although this kind of behavior didn't seem to be very widely extended. I can submit it as a separate patch/PR, whatever is most convenient for you. Thanks! -- 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