问题描述
我使用 Apache Tika 解析 RTF 文件以获取纯文本作为字符串.现在我想从这个字符串中删除一些字符 -> 好的.现在我想再次将结果保存为 RTF.(您可以将此过程视为通过删除段落来修改 RTF 文件.)这怎么可能?如何使用 Tika 将此字符串导出到 RTF?
I use Apache Tika to parse RTF files to get the plaintext as string. Now I want to remove some characters from this string -> ok. Now I want to save the result as RTF again. (You can think of this process as modifying an RTF file by deleting a paragraph.) How is this possible? How can I export this string to RTF with Tika?
推荐答案
有一个编辑文档的解决方案,但有点复杂.您可以使用 OpenOffice API 打开多种类型的文档并将其导出为其他格式.前段时间我用它从数据库中读取数据并导出为 odt 和 xls 文件.
There is a solution to edit docs, but it is a little complex. You can use the OpenOffice API to open a lot of types of docs and export it to other formats. I used it, sometime ago, to read data from a database and export as an odt and xls file.
我从来没有用它来编辑文档,比如来自 Writer 或 MS Word 的文件,但是,通过 OpenOffice 文档,我知道这是可能的.也许这可以成为杀死苍蝇的大炮,但如果您没有找到其他方法,可以解决您的问题.
I never used it to edit a doc, like a file from Writer or MS Word, but, by the OpenOffice documentation, I know that is possible to do it. Maybe this can be a cannon to kill a fly, but if you don find any other ways, could solve your problem.
API 适用于 Java、C++ 等.
The API works with Java, C++ etc.
这篇关于Java RTF 可以导入、编辑和导出吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!