python docx文档页面设置 |
您所在的位置:网站首页 › 如何把word页面设置为横向 › python docx文档页面设置 |
最近需要docx页面输出,需要将正常纵向页面转为横向页面,查了一些资料,发现很多都是科普的解释,并没有讲出具体怎么做,现在贴出我实现的代码。 需要引入的: from docx import Document from docx.enum.section import WD_ORIENT纵向转横向的代码: document = Document() section = document.sections[0] new_width, new_height = section.page_height, section.page_width section.orientation = WD_ORIENT.LANDSCAPE section.page_width = new_width section.page_height = new_height接着就开始自己需要的文档操作。 以上就是如何设置文档输出从纵向转为横向排布。 |
今日新闻 |
推荐新闻 |
CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3 |