首页 > 编程语言 > 详细

基于python实现自动化办公学习笔记四

时间:2019-08-08 20:07:27      阅读:210      评论:0      收藏:0      [点我收藏+]

PPT
(1)写PPT

import win32com
import win32com.client


def makeppt(path):
ppt = win32com.client.Dispatch("PowerPoint.Application")
ppt.Visible = True
pptFile = ppt.Presentations.Add()

# 创建页
page1 = pptFile.Slides.Add(1, 1)
t1 = page1.Shapes[0].TextFrame.TextRange
t1.Text = "sunck"
t2 = page1.Shapes[1].TextFrame.TextRange
t2.Text = "sunck is a good man"
# 保存
pptFile.SaveAs(path)
pptFile.Close()
ppt.Quit()


path = r"E:\\Python\\py17\\automatictext\\sunk.ppt"
makeppt(path)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
5、PDF

import win32com
import win32com.client


def makeppt(path):
ppt = win32com.client.Dispatch("PowerPoint.Application")
ppt.Visible = True
pptFile = ppt.Presentations.Add()

# 创建页
page1 = pptFile.Slides.Add(1, 1)
t1 = page1.Shapes[0].TextFrame.TextRange
t1.Text = "sunck"
t2 = page1.Shapes[1].TextFrame.TextRange
t2.Text = "sunck is a good man"
# 保存
pptFile.SaveAs(path)
pptFile.Close(http://www.amjmh.com/v/BIBRGZ_558768/)
ppt.Quit()


path = r"E:\\Python\\py17\\automatictext\\sunk.ppt"
makeppt(path)
---------------------

基于python实现自动化办公学习笔记四

原文:https://www.cnblogs.com/ly570/p/11322905.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!