Get Line Width & Style of Paragraph Borders in Word DOCX Document using Java


I’m trying to parse a word document with Aspose.Words for Java 20.4.
I’ve added a border to the first paragraph. Aspose returns the same border for all paragraphs in the document.

Is this the expected behavior?

image.png (34.5 KB)

border (19.0 KB)



You are right; the following code of Aspose.Words for Jave returns 0.5 for all Paragraphs in document’s body:

Document doc = new Document("E:\\Temp\\border issue\\border issue.docx");

for (Paragraph para : (Iterable<Paragraph>) doc.getFirstSection().getBody().getChildNodes(NodeType.PARAGRAPH, true)) {

But, this is an expected behavior and you can confirm it in MS Word 2019. Just place cursor on these three Paragraphs and press SHIFT+F1 to open Reveal Formatting box. Please check the following screenshot:

Hope, this helps.