Update richtext_eastAsia.py

This commit is contained in:
sailingnn 2022-08-04 09:05:06 +08:00 committed by GitHub
parent b75867397a
commit a9122c34d4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,5 +1,10 @@
# -*- coding: utf-8 -*-
'''
Created : 2022-08-03
@author: Dongfang Song
'''
from docxtpl import DocxTemplate, RichText from docxtpl import DocxTemplate, RichText
tpl=DocxTemplate('test_files/richtext_eastAsia_tpl.docx') tpl=DocxTemplate('templates/richtext_eastAsia_tpl.docx')
rt = RichText('测试TEST', font = 'Microsoft YaHei') rt = RichText('测试TEST', font = 'Microsoft YaHei')
ch = RichText('测试TEST', font = '微软雅黑') ch = RichText('测试TEST', font = '微软雅黑')
sun = RichText('测试TEST', font = 'SimSun') sun = RichText('测试TEST', font = 'SimSun')
@ -10,4 +15,4 @@ context = {
} }
tpl.render(context) tpl.render(context)
tpl.save('test_files/richtext_eastAsia.docx') tpl.save('output/richtext_eastAsia.docx')