We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

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

Hi,

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 issue.zip (19.0 KB)

Thanks

@mrastenis,

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)) {
    System.out.println(para.getParagraphFormat().getBorders().getTop().getLineWidth());
} 

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.