Hello everyone
I am creating a word document trying to justify a paragraph.
$"[p Alignment=Center]text here[/p]"$
I have tried to use all the constants described in:
https://poi.apache.org/apidocs/dev/org/apache/poi/xwpf/usermodel/ParagraphAlignment.html
But I can only adjust the text, and I can't justify it
I found the following:
https://stackoverflow.com/questions/43427006/how-can-i-do-to-justify-a-paragraph-with-apache-poi
I included the following:
Me.as(JavaObject).RunMethod("justifica", Array(doc.XWPFDocument.RunMethod("getParagraphArray",Array(1))))
#if java
import org.apache.poi.xwpf.usermodel.*;
public static void justifica(XWPFParagraph ParagraphToModify) {
//ParagraphToModify.setAlignment(ParagraphAlignment.BOTH);
//ParagraphToModify.setAlignment(ParagraphAlignment.THAI_DISTRIBUTE);
ParagraphToModify.setAlignment(ParagraphAlignment.DISTRIBUTE);
}
#EndIf
But equally the text is not justified, it is only aligned.
Small program attached
I would like to know if there is a way to justify the text of a specific paragraph.
Thanks in advance
I am creating a word document trying to justify a paragraph.
$"[p Alignment=Center]text here[/p]"$
I have tried to use all the constants described in:
https://poi.apache.org/apidocs/dev/org/apache/poi/xwpf/usermodel/ParagraphAlignment.html
But I can only adjust the text, and I can't justify it
I found the following:
https://stackoverflow.com/questions/43427006/how-can-i-do-to-justify-a-paragraph-with-apache-poi
I included the following:
Me.as(JavaObject).RunMethod("justifica", Array(doc.XWPFDocument.RunMethod("getParagraphArray",Array(1))))
#if java
import org.apache.poi.xwpf.usermodel.*;
public static void justifica(XWPFParagraph ParagraphToModify) {
//ParagraphToModify.setAlignment(ParagraphAlignment.BOTH);
//ParagraphToModify.setAlignment(ParagraphAlignment.THAI_DISTRIBUTE);
ParagraphToModify.setAlignment(ParagraphAlignment.DISTRIBUTE);
}
#EndIf
But equally the text is not justified, it is only aligned.
Small program attached
I would like to know if there is a way to justify the text of a specific paragraph.
Thanks in advance