add utf-8 support in header/footer -> docxtpl 0.2.2
This commit is contained in:
parent
12316e94d7
commit
4e024bef06
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
25
tests/header_footer_utf8.py
Normal file
25
tests/header_footer_utf8.py
Normal 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.
BIN
tests/test_files/header_footer_tpl_utf8.docx
Normal file
BIN
tests/test_files/header_footer_tpl_utf8.docx
Normal file
Binary file not shown.
BIN
tests/test_files/header_footer_utf8.docx
Normal file
BIN
tests/test_files/header_footer_utf8.docx
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user