Using variable images with django-webodt

旧街凉风 提交于 2019-11-30 16:06:44

问题


Is anyone using django-webodt? Looking through the documentation, I can't find anything about using images in a document. I want to insert "variable" images (ImageField) in my ODT document. Is this possible?

I'm using the OpenOffice backend.


回答1:


I don't know if it is a solution for you, I use pod in my projects with nice results, I have never tested to include images but it is documented:

Quoting pod doc:

Integrating external files or images into the result: the document function

The document function allows you to integrate, into the ODT result, images or files that come from external sources. Here is the function signature; the table below explains each parameter.

EDITED DUE OP COMMENT

I come to test it and work pretty well, also into loops. Here you can see python (or django) rendering document with images:

>>> from appy.pod.renderer import Renderer
>>> taula1 = [1,2,3]
>>> taula = [ taula1, taula1 ]
>>> renderer = Renderer('report.odt',  globals(), 'result.odt')
>>> renderer.run()

ODT:

Result:



来源:https://stackoverflow.com/questions/16943597/using-variable-images-with-django-webodt

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!