我想用 python 或 php 将多个图像写入 odt 文件
我想将多个图像文件写入 odt 文件。我将指定一个目录,脚本将从那里通过循环获取它。但我从哪里开始呢?我以前从来没有做过这样的事!
我找到了这个python代码,它可以将html转换为python...所以我们可以先解析一个html,然后调用这个。但没有关于如何使用它的参考。
I want to write multiple image files to a odt file. I will be specifying a dir and the script will take it from there thru a loop. But where do i start? I have never done anything like this before!
I found this python code, which can convert html 2 python... so we can parse an html first and then call this one. But there is no reference on how to use this.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
最后我找到了一种直接编写odt的PHP方法!它有据可查。
http://www.odtphp.com/
我还用php写了一个完整的实用解决方案。您可以上传多个图像并生成 odt 文档。
该代码托管在 http://code.google.com/p/images2odt/
第一篇文章在此处完成。
Atlast I found a PHP way to write odt direct! Its well documented.
http://www.odtphp.com/
I have also written a complete practical solution in php. You can upload multiple images and get the odt document generated.
The code is hosted at http://code.google.com/p/images2odt/
The first post is done here.
对于任何想要使用 Python 代码的人来说,都需要 Python 解释器版本 2.6。它也可能适用于 2.7 版本。它主要用于Linux,但也有Windows和Mac版本。您还需要
from
和import
语句中列出的文件。这些文件位于其他一些文件夹中。它看起来像是一个更大的 Linux 软件包的一部分。最后一件事,Python 脚本通常从命令行获取参数。附加信息:
我查看了 setup.py 文件,它告诉我这是一个名为 odfpy 的开放文档 API 库。版本是0.9.2。它的文档链接已损坏。谷歌搜索 odfpy 找到了一个可以在 tarbell 中下载更新版本(0.9.4)的地方:
http://pypi.python.org/pypi/odfpy
可以在此处找到文档打开Office文档:
https://joinup.ec.europa.eu/software/odfpy/document /api-odfpyodt
For anyone wanting to use the Python code will need a Python interpreter version 2.6. It might also work with version 2.7. It's mainly used in Linux but there are Windows and Mac versions as well. You will also need the files listed in the
from
andimport
statements. These files are in some of the other folders. It looks like it is a part of a much bigger Linux package. One last thing, Python scripts usually takes their arguments from a command line.Additional info:
I looked over the setup.py file and it told me that this is an API library for open documents called odfpy. The version is 0.9.2. The link it has for the documentation is broken. A google search for odfpy came up with a place to download a more recent version (0.9.4) in a tarbell here:
http://pypi.python.org/pypi/odfpy
The documentation can be found here in an Open Office document:
https://joinup.ec.europa.eu/software/odfpy/document/api-odfpyodt