mercredi 6 mai 2015

How to create Bullet Square in Word POI Java [on hold]

I dealt the creation of a document . I used the API POI to create the document in Word format. It can help you to create lists. You have best solutions? Thanks!!

This is my solution:

public class SetBulletSquareWordPOI {
    private static String FILE_DOC = "C:/Temp/Test1.doc";
    public static void main(String[] args) throws Exception {
        XWPFDocument doc = new XWPFDocument();
        XWPFParagraph para = doc.createParagraph();
        para.setVerticalAlignment(TextAlignment.CENTER);
        XWPFRun run = para.createRun();
        //Character Square
        run.setText(String.valueOf((char) 110));
        // Font importatnte for display
        run.setFontFamily("Wingdings");
        run.setFontSize(6);
        run = para.createRun();
        run.setText(" Forza Roma");
        run.setFontFamily("Verdana");
        run.setFontSize(10);
        try(FileOutputStream out = new FileOutputStream(FILE_DOC)){
            doc.write(out);
        }
    }
}

Aucun commentaire:

Enregistrer un commentaire