Using variable images with django-webodt

后端 未结 1 1994
傲寒
傲寒 2021-01-03 09:51

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)

相关标签:
1条回答
  • 2021-01-03 10:49

    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:

    enter image description here

    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:

    enter image description here

    Result:

    enter image description here

    0 讨论(0)
提交回复
热议问题