Add font option in RichText

This commit is contained in:
Eric Lapouyade 2018-06-07 16:42:12 +02:00
parent 86350034bb
commit 95ffebb3fe
21 changed files with 10 additions and 2 deletions

View File

@ -1,3 +1,7 @@
0.4.12 (2018-06-07)
-------------------
- Add font option in RichText
0.4.11 (2018-05-16)
-------------------
- Better tabs and spaces management for MS Word 2016

View File

@ -5,7 +5,7 @@ Created : 2015-03-12
@author: Eric Lapouyade
'''
__version__ = '0.4.11'
__version__ = '0.4.12'
from lxml import etree
from docx import Document
@ -425,7 +425,7 @@ class RichText(object):
if strike:
prop += u'<w:strike/>'
if font:
prop += u'<w:rFonts w:ascii="Courier New" w:hAnsi="{}" w:cs="{}"/>'.format(font, font)
prop += u'<w:rFonts w:ascii="{font}" w:hAnsi="{font}" w:cs="{font}"/>'.format(font=font)
self.xml += u'<w:r>'
if prop:

View File

@ -27,6 +27,10 @@ rt.add('\n1st line')
rt.add('\n2nd line')
rt.add('\n3rd line')
rt.add('\n\n<cool>')
rt.add('\nFonts :\n',underline=True)
rt.add('Arial\n',font='Arial')
rt.add('Courier New\n',font='Courier New')
rt.add('Times New Roman\n',font='Times New Roman')
context = {
'example' : rt,

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.

Binary file not shown.

Binary file not shown.

Binary file not shown.