Document document=new Document();
document.loadFromFile(inputFile);
//找到"PermissionStart" and "PermissionEnd" 标签并删除
for(int j=0;j<document.getSections().getCount();j++){
Section section=document.getSections().get(j);
for(int k=0;k<section.getParagraphs().getCount();k++){
Paragraph paragraph=section.getParagraphs().get(k);
for(int i=0;i<paragraph.getChildObjects().getCount();){
DocumentObject obj=paragraph.getChildObjects().get(i);
if(obj instanceof PermissionStart ||obj instanceof PermissionEnd){
paragraph.getChildObjects().remove(obj);
}else{
i++;
}
}
}
}
document.saveToFile(outputFile,FileFormat.Docx);