python-docx-template icon indicating copy to clipboard operation
python-docx-template copied to clipboard

htmltodocx

Open Mustard404 opened this issue 5 years ago • 3 comments

i want add html code to word,or copy a.docx to demo.docx

test1

test2

Mustard404 avatar Apr 16 '21 20:04 Mustard404

应该实现不了,我遇到过如果带有注释符的代码(例如: <!-- ) 会导致 生成word时候 后面的内容都被注释掉,怀疑是jinja2的问题。

the-404 avatar Jun 13 '21 05:06 the-404

应该实现不了,我遇到过如果带有注释符的代码(例如: <!-- ) 会导致 生成word时候 后面的内容都被注释掉,怀疑是jinja2的问题。

我项目中应该没有这种情况,目前考虑两种方案,但是都有问题。 1.将html通过docx转成word文档,但是不知道怎么把html转的文档复制到现有文档中。 2.就是写过滤器,把html代码直接解析成正常文档,不知道这么过滤器怎么写。

Mustard404 avatar Jul 16 '21 08:07 Mustard404

If you want to add html code as a listing of code : juste use escaping (see doc) If you want to add a rendered html code, it is not possible

elapouya avatar Jul 16 '21 09:07 elapouya