import
java.io.File;
import
java.io.FileOutputStream;
import
org.apache.poi.xwpf.usermodel.XWPFDocument;
import
org.apache.poi.xwpf.usermodel.XWPFParagraph;
import
org.apache.poi.xwpf.usermodel.XWPFRun;
public
class
GFG {
public
static
void
main(String[] args)
throws
Exception
{
XWPFDocument xwpfdocument =
new
XWPFDocument();
File file =
new
File(
"C:/alignParagraph.docx"
);
FileOutputStream ostream
=
new
FileOutputStream(file);
XWPFParagraph para = xwpfdocument.createParagraph();
paragraph.setAlignment(ParagraphAlignment.CENTER);
XWPFRun xwpfrun = para.createRun();
xwpfrun.setText(
"Geeks for Geeks is a computer science portal which aims "
+
"to provide all in one platform for learning and "
+
"practicing.We can learn multiple "
+
"programming languages here. It also provided content for"
+
"UGC NET and JRF exams."
);
para = xwpfdocument.createParagraph();
para.setAlignment(ParagraphAlignment.RIGHT);
xwpfrun = para.createRun();
xwpfrun.setText(
"It also helps you to also prepare for various other "
+
"competitive exams.Also lets you prepare for interviews."
);
xwpfdocument.write(ostream);
ostream.close();
}
}