<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>5.2.2</version>
</dependency>
public PipedInputStream getHtZsResultUrl(List<HtZsVO> htZsVOList) throws IOException {
XWPFDocument document = new XWPFDocument();
XWPFParagraph paragraph = document.createParagraph();
XWPFRun runParagraph = paragraph.createRun();
runParagraph.setText(htZs.getParagraph());
runParagraph.setFontFamily("fantasy");
runParagraph.setFontSize(10);
XWPFRun runWord = paragraph.createRun();
runWord.setText(htZs.getWord());
PipedInputStream in = new PipedInputStream();
PipedOutputStream out = new PipedOutputStream(in);
new Thread(
() -> {
try {
document.write(out);
out.close();
} catch (IOException e) {
throw new RuntimeException(e);
}
}
).start();
return in;
}