java - Apache Poi XWPFHeaderFooter not working -
i need replace texts in docx header, don't have success.... wrong in code? header text not replaced. idea??
xwpfheaderfooterpolicy headerfooterpolicy = document .getheaderfooterpolicy(); xwpfheaderfooter header = headerfooterpolicy.getdefaultheader(); xwpfparagraph paragraph = header.getlistparagraph().iterator().next(); if (!paragraph.getruns().isempty()) { list<xwpfrun> runs = paragraph.getruns(); (int = 0; < runs.size(); i++) { string oneparastring = runs.get(i).getdocument().getheaderlist().get(i).gettext(); system.out.println(oneparastring); (map.entry<string, string> entry : mapa.entryset()) { oneparastring = oneparastring.replace(entry.getkey(), entry.getvalue()); } runs.get(i).settext(oneparastring,0); } }
java apache-poi
No comments:
Post a Comment