Reputation:
A quick help here, I was reading the library's manual but couldn't find any help. I have the below code where I used the alignment BOTH in order to achieve the justified alignemnt that Word has, but the output is not what I wanted. The last line is also aligned fully and it's not nice. How can I break it?
XWPFParagraph paragraph = document.createParagraph();
XWPFRun run = paragraph.createRun();
paragraph.setAlignment(ParagraphAlignment.BOTH);
run.setText("...adding big text here...");
run.addBreak();
Upvotes: 2
Views: 55
Reputation:
I just tried some things and found it eventually guys.
XWPFParagraph paragraph2 = document.createParagraph();
XWPFRun run2 = paragraph2.createRun();
paragraph2.setAlignment(ParagraphAlignment.BOTH);
run2.setText("...text here....");
XWPFParagraph paragraph3 = document.createParagraph();
XWPFRun run3 = paragraph3.createRun();
paragraph3.setAlignment(ParagraphAlignment.BOTH);
run3.addBreak();
run3.addBreak();
run3.setText("...text here...");
Works like a charm
Upvotes: 0