@Test public void testCreateDocxWithAlign() { try { WordUtil.createWithAlign("d: } catch (IOException e) { e.printStackTrace(); } }
public static void createWithAlign(String filename) throws IOException { XWPFDocument document = new XWPFDocument(); FileOutputStream out = new FileOutputStream(new File(filename)); XWPFParagraph paragraph = document.createParagraph(); paragraph.setAlignment(ParagraphAlignment.RIGHT); XWPFRun run = paragraph.createRun(); run.setText("At tutorialspoint.com, we strive hard to " + "provide quality tutorials for self-learning " + "purpose in the domains of Academics, Information " + "Technology, Management and Computer Programming " + "Languages."); paragraph = document.createParagraph(); paragraph.setAlignment(ParagraphAlignment.CENTER); run = paragraph.createRun(); run.setText("The endeavour started by Mohtashim, an AMU " + "alumni, who is the founder and the managing director " + "of Tutorials Point (I) Pvt. Ltd. He came up with the " + "website tutorialspoint.com in year 2006 with the help" + "of handpicked freelancers, with an array of tutorials" + " for computer programming languages. "); document.write(out); out.close(); System.out.printf("create %s written successully\n", filename); }
WordUtil { public static void createWithAlign(String filename) throws IOException { XWPFDocument document = new XWPFDocument(); FileOutputStream out = new FileOutputStream(new File(filename)); XWPFParagraph paragraph = document.createParagraph(); paragraph.setAlignment(ParagraphAlignment.RIGHT); XWPFRun run = paragraph.createRun(); run.setText("At tutorialspoint.com, we strive hard to " + "provide quality tutorials for self-learning " + "purpose in the domains of Academics, Information " + "Technology, Management and Computer Programming " + "Languages."); paragraph = document.createParagraph(); paragraph.setAlignment(ParagraphAlignment.CENTER); run = paragraph.createRun(); run.setText("The endeavour started by Mohtashim, an AMU " + "alumni, who is the founder and the managing director " + "of Tutorials Point (I) Pvt. Ltd. He came up with the " + "website tutorialspoint.com in year 2006 with the help" + "of handpicked freelancers, with an array of tutorials" + " for computer programming languages. "); document.write(out); out.close(); System.out.printf("create %s written successully\n", filename); } }
WordUtil { public static void createWithAlign(String filename) throws IOException { XWPFDocument document = new XWPFDocument(); FileOutputStream out = new FileOutputStream(new File(filename)); XWPFParagraph paragraph = document.createParagraph(); paragraph.setAlignment(ParagraphAlignment.RIGHT); XWPFRun run = paragraph.createRun(); run.setText("At tutorialspoint.com, we strive hard to " + "provide quality tutorials for self-learning " + "purpose in the domains of Academics, Information " + "Technology, Management and Computer Programming " + "Languages."); paragraph = document.createParagraph(); paragraph.setAlignment(ParagraphAlignment.CENTER); run = paragraph.createRun(); run.setText("The endeavour started by Mohtashim, an AMU " + "alumni, who is the founder and the managing director " + "of Tutorials Point (I) Pvt. Ltd. He came up with the " + "website tutorialspoint.com in year 2006 with the help" + "of handpicked freelancers, with an array of tutorials" + " for computer programming languages. "); document.write(out); out.close(); System.out.printf("create %s written successully\n", filename); }  }
WordUtil { public static void createWithAlign(String filename) throws IOException { XWPFDocument document = new XWPFDocument(); FileOutputStream out = new FileOutputStream(new File(filename)); XWPFParagraph paragraph = document.createParagraph(); paragraph.setAlignment(ParagraphAlignment.RIGHT); XWPFRun run = paragraph.createRun(); run.setText("At tutorialspoint.com, we strive hard to " + "provide quality tutorials for self-learning " + "purpose in the domains of Academics, Information " + "Technology, Management and Computer Programming " + "Languages."); paragraph = document.createParagraph(); paragraph.setAlignment(ParagraphAlignment.CENTER); run = paragraph.createRun(); run.setText("The endeavour started by Mohtashim, an AMU " + "alumni, who is the founder and the managing director " + "of Tutorials Point (I) Pvt. Ltd. He came up with the " + "website tutorialspoint.com in year 2006 with the help" + "of handpicked freelancers, with an array of tutorials" + " for computer programming languages. "); document.write(out); out.close(); System.out.printf("create %s written successully\n", filename); }  static void create(String filename); static void create(String filename, String content); static void createWithBorders(String filename, String content); static void createWithTable(String filename); static void createWithFontStyle(String filename); static void createWithAlign(String filename); static void extractor(String filename); static void setDocxProperties(String filename); static void setDocProperties(String filename); }
WordUtil { public static void createWithAlign(String filename) throws IOException { XWPFDocument document = new XWPFDocument(); FileOutputStream out = new FileOutputStream(new File(filename)); XWPFParagraph paragraph = document.createParagraph(); paragraph.setAlignment(ParagraphAlignment.RIGHT); XWPFRun run = paragraph.createRun(); run.setText("At tutorialspoint.com, we strive hard to " + "provide quality tutorials for self-learning " + "purpose in the domains of Academics, Information " + "Technology, Management and Computer Programming " + "Languages."); paragraph = document.createParagraph(); paragraph.setAlignment(ParagraphAlignment.CENTER); run = paragraph.createRun(); run.setText("The endeavour started by Mohtashim, an AMU " + "alumni, who is the founder and the managing director " + "of Tutorials Point (I) Pvt. Ltd. He came up with the " + "website tutorialspoint.com in year 2006 with the help" + "of handpicked freelancers, with an array of tutorials" + " for computer programming languages. "); document.write(out); out.close(); System.out.printf("create %s written successully\n", filename); }  static void create(String filename); static void create(String filename, String content); static void createWithBorders(String filename, String content); static void createWithTable(String filename); static void createWithFontStyle(String filename); static void createWithAlign(String filename); static void extractor(String filename); static void setDocxProperties(String filename); static void setDocProperties(String filename);  }