add utf-8 support in header/footer -> docxtpl 0.2.2

This commit is contained in:
Eric Lapouyade 2016-07-19 10:23:12 +02:00
parent 12316e94d7
commit 4e024bef06
12 changed files with 31 additions and 1 deletions

View File

@ -1,3 +1,8 @@
0.2.2 (2016-06-11)
------------------
- Fix bug where using utf-8 chracters inside foot or header in .docx template
It now detects header/footer encoding automatically
0.2.1 (2016-06-11)
------------------
- Fix bug where using subdocs is corrupting header and footer in generated docx

View File

@ -5,7 +5,7 @@ Created : 2015-03-12
@author: Eric Lapouyade
'''
__version__ = '0.2.1'
__version__ = '0.2.2'
from lxml import etree
from docx import Document

View File

@ -0,0 +1,25 @@
# -*- coding: utf-8 -*-
'''
Created : 2016-07-19
@author: AhnSeongHyun
Edited : 2016-07-19 by Eric Lapouyade
'''
from docxtpl import DocxTemplate
tpl=DocxTemplate('test_files/header_footer_tpl_utf8.docx')
sd = tpl.new_subdoc()
p = sd.add_paragraph(u'This is a sub-document to check it does not break header and footer with utf-8 characters inside the template .docx')
context = {
'title' : u'헤더와 푸터',
'company_name' : u'세계적 회사',
'date' : u'2016-03-17',
'mysubdoc' : sd,
}
tpl.render(context)
tpl.save('test_files/header_footer_utf8.docx')

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.