1 实现方法
/**
* 提取word中的指定页码的页面到新的word
* @param wordFile
* @return
*/
@SneakyThrows
@PostMapping("extractPages")
public Ret extractPages(MultipartFile wordFile){
try(InputStream inputStream = wordFile.getInputStream()) {
Document doc = new Document(inputStream);
//从第2页开始提取 一共提取2页
Document newDoc = doc.extractPages(1, 2);
newDoc.save("C:/Users/Administrator/Desktop/aspose/抽取部分页面后.docx");
}
return Ret.success();
}
2 实现效果

原本有4页

提取后只有2页