V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
llllllllllllllii
V2EX  ›  Python

4202 年了,有没有好的 doc 文件内容处理方案啊

  •  
  •   llllllllllllllii · 2024-06-07 11:23:30 +08:00 · 2256 次点击
    这是一个创建于 428 天前的主题,其中的信息可能已经有所发展或是发生改变。

    python-docx 可以处理 docx 文件,doc 会有问题。 如果将 doc 转为 docx 就需要借助外部 win32com 或 libreoffice ,有没有能不借助外部处理方法 或者有没有可以处理 doc 内容获取的的库

    12 条回复    2024-06-08 17:41:46 +08:00
    openmynet
        1
    openmynet  
       2024-06-07 11:52:10 +08:00
    Linux 系统下可以使用 wv 进行处理

    wvHtml input.doc output.html
    # to text
    wvText input.doc output.txt

    alpine3 liunx:
    apk add --no-cache wv

    ubuntu:
    apt-get install -y wv
    azarasi
        2
    azarasi  
       2024-06-07 11:52:37 +08:00
    pandoc
    undeflife
        3
    undeflife  
       2024-06-07 12:06:23 +08:00   ❤️ 6
    4202 年了,我的方案是不兼容 doc 和 xls 格式
    Latin
        4
    Latin  
       2024-06-07 14:25:58 +08:00
    antiword
    djangovcps
        5
    djangovcps  
       2024-06-07 15:43:39 +08:00
    aspose
    xiqnshang
        6
    xiqnshang  
       2024-06-07 15:44:15 +08:00
    我之前处理 doc 文件,写了个转换服务把 doc 转成 docx ,然后把 docx 丢给后台处理
    ysc3839
        7
    ysc3839  
       2024-06-07 15:50:05 +08:00 via Android
    看看 WPS 有没有提供什么 API ?
    lisxour
        8
    lisxour  
       2024-06-07 15:58:16 +08:00   ❤️ 1
    还是算了吧,毕竟不开源的格式,你强行支持,在用的时候遇到兼容问题这才真的头痛,你自己几乎是完全无法解决的。
    bugmakerxs
        9
    bugmakerxs  
       2024-06-07 16:52:35 +08:00
    word 处理还是第三方比较靠谱,wps ,libreoffice ,aspose
    wumoumou
        10
    wumoumou  
       2024-06-07 22:31:56 +08:00
    mammoth.browser.js 这个可以把 doc 转成 html ,提取 html 的内容相对容易些
    TsubasaHanekaw
        11
    TsubasaHanekaw  
       2024-06-08 10:46:56 +08:00
    找台 windows 用 com+接口把 doc 转成 docx,同时还能完成 word ,excel ,ppt 转成 pdf 这些麻烦操作
    fuge
        12
    fuge  
       2024-06-08 17:41:46 +08:00
    Powershell
    关于   ·   帮助文档   ·   自助推广系统   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   2842 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 22ms · UTC 06:05 · PVG 14:05 · LAX 23:05 · JFK 02:05
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.