使用python-docx从docx文件中读取coreproperties关键字 [英] reading coreproperties keywords from docx file with python-docx
问题描述
从脚本此处,我知道如何使用python-docx的coreproperties函数设置文档关键字.我想看看别人编写的文档中已经存在的关键字.是否有一个getcoreproperties函数或一个关键字属性或类似的东西?
From the script here I see how to set document keywords with the coreproperties function of python-docx. I want to look at the keywords already in a document written by someone else. Is there a getcoreproperties function or a keywords attribute or something similar?
我已将文件夹C:\ Python27 \ Lib \ site-packages \ python_docx-0.5.0-py2.7.egg \ docx夹住,其中没有.py文件包含字符串"core",我已经在一些事情上调用了doc(),但没有发现任何有希望的事情.我应该在哪里/如何寻找这种事情的线索?
I've grepped in folder C:\Python27\Lib\site-packages\python_docx-0.5.0-py2.7.egg\docx and none of the .py files there have the string "core" in them, and I've called doc() on a few things but without finding anything promising. Where/how should I look for clues to this kind of thing?
推荐答案
python-docx
库从v0.5.0开始不支持核心属性.但是碰巧的是,这应该相对容易补救.
The python-docx
library doesn't have support for core properties as of v0.5.0. But as it happens, that should be relatively easy to remedy.
python-pptx
姐妹项目支持核心属性,如下所述:
http://python-pptx.readthedocs.org/en /latest/api/presentation.html#coreproperties-objects
The python-pptx
sister project has support for core properties, as explained here:
http://python-pptx.readthedocs.org/en/latest/api/presentation.html#coreproperties-objects
由于两个项目都基于相同的体系结构,因此该代码应基本上可以按原样重用.事实证明,开放包装约定"的核心属性位是通用的,这对于所有三种MS Office XML文件格式都是相同的.
Since the two projects are based on the same architecture, that code should be reusable essentially as-is. It turns out the core-properties bits are common to the the Open Packaging Convention, which is the same for all three of the MS Office XML file formats.
如果您要在GitHub问题跟踪器上添加问题,我会看到我们多快能解决这个问题. https://github.com/python-openxml/python-docx/issues
If you'll add an issue on the GitHub issue tracker I'll see how soon we can get to it. https://github.com/python-openxml/python-docx/issues
这篇关于使用python-docx从docx文件中读取coreproperties关键字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!