XWPFDocument:更改文档的字体大小

时间:2019-10-16 14:54:35

标签: java xwpf

我想将docx文档的字体大小(更改为12)

XWPFDocument document = new XWPFDocument(new FileInputStream("temp_"+idConsultant+".docx"));
List<XWPFParagraph> paragraphs = document.getParagraphs();

for (XWPFParagraph para : paragraphs) {
    for (XWPFRun run : para.getRuns()) {
        run.setFontSize(12);
    }
}
document.write(new FileOutputStream(fileName));
fis.close();

它不起作用,字体大小没有改变

0 个答案:

没有答案