Java 回复Word批注

 时间:2024-12-04 20:36:17

以下经验内容将分享通过java编程来回复Word中的批注内容。

工具/原料

Free Spire.Doc for Java 2.0.0

IntelliJ IDEA

jar文件导入

1、Step 1: 通过官网下载jar文件包后,解压;Step 2: 在程序中新建一个Directory目录,并命名;Step 3: 将解压后文件lib中的Spire.Doc.jar文件复制到糕恍阏绯新建的目录下;Step 4: 鼠标选中复制后的jar文件,右键,选中“Add as Library”,完成导入。

Java代码示例

1、import com.spire.doc.*;import com.spire.doc.fields.Comment;public class ReplyComment { public static void main(String[] args) throws Exception{ //加载测试文档 Document doc = new Document("AddComment.docx"); //获取指定批注 Comment comment = doc.getComments().get(0); //回复批注 Comment relyC= new Comment(doc); relyC.getFormat().setAuthor("实验组"); relyC.getBody().addParagraph().appendText("已完成。"); comment.replyToComment(relyC); //保存文档 doc.saveToFile("ReplyComment.docx",FileFormat.Docx_2010); }}

2、批注回复效果:

Java 回复Word批注
  • word批注如何隐藏
  • word文档如何使用批注?
  • word新建批注,如何取消批注
  • C# 如何回复Word批注
  • Java 添加Word批注(文本、图片)
  • 热门搜索
    烧鸭的做法 韭菜鸡蛋饼的做法 白鲳鱼的做法 鱼子的做法 小炒肉的做法 红烧肉的做法窍门 百合莲子粥的做法 自制奶酪的做法 蓝牙耳机怎么恢复双耳模式 蒸排骨的家常做法