Apache POI HWPF,替换 .doc 文档中的文本失败

发布于 2024-07-26 10:20:55 字数 412 浏览 3 评论 0原文

我尝试在以下位置写下 POI 单元测试的结果: 在此处编写代码,方法是将该行添加

daDoc.write(new FileOutputStream("C:\\wordtest.doc"));

到方法 testRangeReplacementAll 的末尾。 当我尝试使用 Word 2003 打开新文档时,该文档已损坏。

有什么建议可以解决此问题吗?

I try to write down the result of the POI unit test at: code here, by adding the line

daDoc.write(new FileOutputStream("C:\\wordtest.doc"));

to the end of the method testRangeReplacementAll. The new document is corrupt when I try to open it with word 2003.

Any suggestions to fix this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

浴红衣 2024-08-02 10:20:55

我至少会尝试缩小范围,因为该测试做了很多事情。

  1. 你能在Word 2003中打开原始文件吗?
  2. 您可以打开该文件并立即重新另存为另一个文件而不进行任何替换吗? 可以在 Word 2003 中打开吗?
  3. 你能至少进行一次更换吗?

I would at least try to narrow this down, since that test does a number of things.

  1. Can you open the original file in Word 2003 ?
  2. can you open the file and immediately resave as another without doing any replacements. Does that open in Word 2003 ?
  3. can you perform one replacement at least ?
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文