https://bz.apache.org/bugzilla/show_bug.cgi?id=69720
Bug ID: 69720
Summary: Paragraph alignment value defaults to left, null not
allowed
Product: POI
Version: 5.4.x-dev
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P2
Component: XWPF
Assignee: [email protected]
Reporter: [email protected]
Target Milestone: ---
Created attachment 40051
--> https://bz.apache.org/bugzilla/attachment.cgi?id=40051&action=edit
Test case.
When calling XWPFParagraph.getAlignment(), if the alignment value was not set
in the original document, the method with return ParagraphAlignment.LEFT. This
doesn't allow us to tell if the paragraph alignment is governed by the style
hierarchy, or if it has direct format. As a workaround, we can call
getCTP().getPPr().isSetJc() to know if the LEFT value is real or a fallback.
I'm attaching a test document with two paragraphs, the first one is rendered at
the center (due to its style) and the second one renders to the left (due to
paragraph attributes). Calling XWPFParagraph.getAlignment() on these paragraphs
returns ParagraphAlignment.LEFT and ParagraphAlignment.START, respectively.
Another angle of the same problem, it's not possible to set the paragraph
alignment value to null, to set a paragraph to follow the alignment value
defined in the style.
Other API methods, like XWPFRun.get/setFontSizeAsDouble(), allow null values,
so I think it would be adequate for get/setAlignment() to behave this way.
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]