附件中文件使用HtmlFixedSaveOptions 转为html页面后,部分分数线在chrome中不显示 ,在firefox中可以显示2017-2018-2雅礼集团七年级期中考试数学试卷(1).zip (63.3 KB)
转化代码如下:
String rootPath = “E:\work\redmine\QuestionBank_Tms\”;
FileInputStream is = new FileInputStream(rootPath+“2017-2018-2雅礼集团七年级期中考试数学试卷(1).docx”);
Document doc = new Document(is);
HtmlFixedSaveOptions options = new HtmlFixedSaveOptions();
String tempFolder = rootPath + “\tmp”+ “\”;
options.setTempFolder(“tmp\”);
options.setShowPageBorder(false);
options.setPageMargins(0.0D);
options.setJpegQuality(100);
options.setPrettyFormat(true);
options.setResourceSavingCallback(resourceSavingArgs -> {
String resourceFileName = resourceSavingArgs.getResourceFileName();
File file = new File(tempFolder + resourceFileName);
if (file.exists()) {
file.delete();
}
file.createNewFile();
resourceSavingArgs.setResourceStream(new FileOutputStream(file));
});
FileOutputStream outputStream = new FileOutputStream(tempFolder + “indexHtmlFixed.html”);
doc.save(outputStream, options);
outputStream.close();
html显示内容.png (34.9 KB)
word内容.png (35.0 KB)