1 year ago

#263975

test-img

PIXCEL

I want to change the color, size and style of the font in footer Apache poi XWPF

I want to change the color, size and style of the font in footer Apache poi XWPF

FileInputStream finStream = new FileInputStream(pathToWorkbook);
             XWPFDocument docx = new XWPFDocument(finStream);
             
             docx
                .createFooter(HeaderFooterType.DEFAULT)
                .createParagraph()
                .createRun()
                .setText("FOOTER");

or

XWPFParagraph[] pars;

                CTP ctP = CTP.Factory.newInstance();
                CTText t = ctP.addNewR().addNewT();
                pars = new XWPFParagraph[1];

                XWPFHeaderFooterPolicy hfPolicy = doc.createHeaderFooterPolicy();

                ctP = CTP.Factory.newInstance();
                t = ctP.addNewR().addNewT();
                // footer text
                t.setStringValue("Sample Footer Text");

                pars[0] = new XWPFParagraph(ctP, doc);
                hfPolicy.createFooter(XWPFHeaderFooterPolicy.DEFAULT, pars);

Please help, if you can :)

java

ms-word

footer

xwpf

0 Answers

Your Answer

Accepted video resources