Support more types of underline

This commit is contained in:
UncleOraix 2020-08-28 23:51:42 +08:00
parent fe4e76459f
commit b1453e6eba
2 changed files with 5 additions and 2 deletions

View File

@ -7,7 +7,7 @@ Created : 2015-03-12
import functools
import io
__version__ = '0.10.1'
__version__ = '0.10.2'
from lxml import etree
from docx import Document
@ -714,7 +714,7 @@ class RichText(object):
if italic:
prop += u'<w:i/>'
if underline:
if underline not in ['single', 'double']:
if underline not in ['single', 'double', 'thick', 'dotted', 'dash', 'dotDash', 'dotDotDash', 'wave']:
underline = 'single'
prop += u'<w:u w:val="%s"/>' % underline
if strike:

View File

@ -29,6 +29,9 @@ rt.add('\n1st line')
rt.add('\n2nd line')
rt.add('\n3rd line')
rt.add('\n\n<cool>')
for ul in ['single', 'double', 'thick', 'dotted', 'dash', 'dotDash', 'dotDotDash', 'wave']:
rt.add('\nUnderline : ' + ul + ' \n', underline=ul)
rt.add('\nFonts :\n', underline=True)
rt.add('Arial\n', font='Arial')
rt.add('Courier New\n', font='Courier New')