python-docx 设置标题heading的中文字体类型+设置正文的中文字体类型
依赖包:
from docx import Document
from docx.shared import Pt
from docx.shared import Inches
from docx.oxml.ns import qn
修改正文的中文字体类型,示例代码:(全局设置)
document=Document()
document.styles['Normal'].font.name=u'微软雅黑'
document.styles['Normal']._element.rPr.rFonts.set(qn('w:eastAsia'), u'微软雅黑')
修改3级标题的字体类型,示例代码:
run = document.add_heading('',level=3).add_run(u"应用场景示例: ")#应用场景示例标题
run.font.name=u'微软雅黑'
run._element.rPr.rFonts.set(qn('w:eastAsia'), u'微软雅黑')
python-docx 设置标题heading的中文字体类型+设置正文的中文字体类型的更多相关文章
- 黄聪:Discuz!的SEO优化策略一:如何设置标题 & 如何去掉Powered by Discuz!尾巴
1.如何设置标题 进入 管理中心 -- 全局 -- SEO设置 -- 论坛 -- 标题 ,设置你的网站标题和描述. PS:有人问keywords要不要设置,其实现在keywords对SEO的影响已经微 ...
- python matplotlib 中文显示参数设置
python matplotlib 中文显示参数设置 方法一:每次编写代码时进行参数设置 #coding:utf-8import matplotlib.pyplot as pltplt.rcParam ...
- python matplotlib 中文显示乱码设置
python matplotlib 中文显示乱码设置 原因:是matplotlib库中没有中文字体.1 解决方案:1.进入C:\Anaconda64\Lib\site-packages\matplot ...
- CSS 中的字体兼容写法:用CSS为英文和中文字体分别设置不同的字体
font-family的调用方法: font-family:Arial,'Times New Roman','Microsoft YaHei',SimHei; font:bold 12px/.75em ...
- Android 中文字体的设置方法和使用技巧
Android TextView字体颜色等样式具体解释连接:http://blog.csdn.net/pcaxb/article/details/47341249 1.使用字体库(自己定义字体的使用) ...
- Python字体颜色设置
Python字体颜色设置 平时学习工作中,我们经常会接触到一些大佬写的Python工具,运行起来总会显示出五颜六色的字体,比如红色代表Error , 黄色代表Warning , 绿色代表Success ...
- Ubuntu 12.10 Tty (字符终端) 显示中文,和字体大小设置
Tty通过修改默认的中文编码字符,和安装zhcon都无法显示中文.可安装fbterm来显示中文,命令:sudo apt-get install fbterm安装即可,进入Tty: (Ctrl+Alt+ ...
- CSS为英文和中文字体分别设置不同的字体
font-family的调用方法: div { font-family:Arial,'Times New Roman','Microsoft YaHei',SimHei; font:bold 12px ...
- css 字体样式设置大全
css样式大全(整理版) 字体属性:(font) 大小 {font-size: x-large;}(特大) xx-small;(极小) 一般中文用不到,只要用数值就可以,单位:PX.PD 样式 { ...
随机推荐
- orm Lite的使用
1.什么是ORM Lite orm Lite(Object Relationanl Mapping Lite)是一种用于持久化保存java对象的框架,相对于标准的ORM包来说. 2. Demo ●声明 ...
- 《西部世界》S2E9:蝶化庄周,浮生若梦
原以为第九集能解开本季大半的疑惑,结果还是被骗了……看来<西部世界>铁了心要把主要秘密都放在大结局里揭晓,大家就再等一周吧. 尽管如此,本集还是说清了不少谜团:比如威廉和格蕾丝的真实身份, ...
- Knockout.Js官网学习(selectedOptions绑定、uniqueName 绑定)
selectedOptions绑定 selectedOptions绑定用于控制multi-select列表已经被选择的元素,用在使用options绑定的<select>元素上. 当用户在m ...
- CucumberPeople 1.3.2 发布
CucumberPeople 网站: http://alterhu.github.io/CucumberPeople/ This eclipse plugin based on RubyMine ,a ...
- SoapUI Pro Project Solution Collection-XML assert
in soapui the XML object used here is from org.w3c.dom package so you need to read this article car ...
- 使用zlib库进行目录打包
代码很简单,具体过程就不写了. 关于加密压缩,可以看http://www.zlib.net/zlib_faq.html#faq38 中的描述,说是不支持的,但是创建的时候可以传入密码进去,不过我还没有 ...
- Failed to execute goal org.mybatis.generator:mybatis-generator-maven-plugin:1.3.2:generate
(1)将Maven项目先clean,接着install下 (2)运行mvn mybatis-generator:generate命令 注意修改generatorConfig.xml的location: ...
- JAVA Spring boot相关技巧
1. 注册多实例.@Scope("prototype") 2. 手工方式获取注册的实例. @Autowired private ServletContext servletCont ...
- dos命令dir查找文件的用法及实例
功能:显示目录命令 格式:dir[盘符][路径][/W][/P][/L][/O:排序][/A:属性][/S] 参数介绍: /W -- 以宽行排列方式显示. /P -- 每显示满一屏停顿一下,待用户 ...
- node.js中的框架
node.js中的框架 载自: http://nodeframework.com/ MVC frameworks Sinatra-like These frameworks offer rich co ...