
需求是这样的,转成有一定格式的 text (保留换行,空格等)
docx 转 text 基本搞定,因为 docx 其实是一个 zip,里面是文本格式的 xml,然后用了 html 转 text 的方式,转出来可以接受。
但是 doc 转 text 开始用的 antiword 但是有些文件转不了,想问下大家有什么好的方案吗?
1 hinomo Aug 11, 2018 doc 转 docx (逃 |
2 ghhardy Aug 11, 2018 via Android 试试 python 第三方模块吧,我用过处理 excel 表格的,word 好像也有 |
3 hundan Aug 11, 2018 via Android 直接另存为? |
4 lihongjie0209 Aug 11, 2018 Java 可以用 tika, Python 就不知道了. 从某种程度上来说, Java 的生态确实比 Python 好 |
5 dsp2138 Aug 11, 2018 word:Ctrl+A notebook:Ctrl+V 搞定,效率很高 |
7 tomheng OP @lihongjie0209 我先研究下,谢谢 |
8 tomheng OP @longyujin9 也是一种思路 :) |
9 zjsxwc Aug 11, 2018 这种东西 C#干起来很轻松,不知道 linux 下的 dotnet core 可不可以 |
10 zjsxwc Aug 11, 2018 |
11 stringtheory Aug 11, 2018 可以试试 pandoc |
12 MonoLogueChi Aug 11, 2018 via Android 修正一下,docx 是 rar 压缩包 |
13 lushilu001 Aug 11, 2018 via iPhone catdoc |
14 hundan Aug 11, 2018 via Android @MonoLogueChi 再修正一下,是 zip。 rar 文件头以 Rar 开头 zip 为 pk,docx 文件头是 pk,这是其一,其二,rar 算法为私有。拓展名改为 rar 之后能打开是因为压缩软件自己识别了压缩算法,不能作为根据。建议你自己了解清楚再来修正别人。 |
15 drackzy/strong> Aug 11, 2018 unoconv |
16 cnkiller Aug 11, 2018 via Android 我给楼主说一下吧。com 方式另存为 txt,效果最好 |
18 iwtbauh Aug 11, 2018 via Android soffice --headless --convert-to txt filename.doc |
19 gnaggnoyil Aug 12, 2018 |
20 gamecmt Aug 12, 2018 via Android windows 下可以用 pywin32com。 |
21 PythonAnswer Aug 12, 2018 via iPhone com 是个好东西。linux 下一班怎么玩?有类似的吗? |
22 omph Aug 12, 2018 Apache POI - the Java API for Microsoft Documents |
23 shilyx Aug 12, 2018 poi 读取-》另存为 不过更高级的方案是在 widnows 服务器上安装 office,然后 vc 中使用 activex 控制另存为,完美,绝对完美的 doc-》 docx |
24 ps1aniuge Aug 12, 2018 安装 word。用 powershell 调用 com 方式另存为 txt,效果最好 |
25 gnaggnoyil Aug 12, 2018 @PythonAnswer LibreOffice 据说有个叫 UNO 的东西和.COM 比较类似,具体怎么用不清楚,你可以自己查查看…… |
26 PythonAnswer Aug 12, 2018 via iPhone uno 是包装的 java,调用起来不太爽 |
27 Doodlister Aug 28, 2018 via Android @longyujin9 纯文本的话。。 直接 OCR。。。比你这个还暴力 哈哈 |