今天测试了POI插入标题,正文,图片等操作,
在插图图片的过程中,发现图片并不能正确显示,网上办法一大堆,但是都太麻烦,可能是POI版本的问题,我用的是3.16,添加图片已经可以正常使用了。只不过:
XWPFPicture
org.
apache.
poi.
xwpf.
usermodel.
XWPFRun.addPicture(
InputStream pictureData,
int pictureType,
String filename,
int width,
int height) throws
InvalidFormatException,
IOException
这是方法声明,其中的width、和height可以设置为5000000... 对就是这么大然后就正确显示了