如何使用python代码将记录从excel工作表复制到PowerPoint pptx

问题描述 投票:0回答:1

[任何人都可以让我知道如何使用python代码将记录从excel工作表复制到PowerPoint演示文稿。我使用的库是win32com.client和python-pptx。 excel记录已获得条件格式,但没有格式被复制到简报。

当前,它被复制到PowerPoint,复制的记录为灰色。我需要以确切的方式说出它在excel上的表现。

import win32com.client


ExcelApp = win32com.client.Dispatch("Excel.Application")
ExcelApp.Visible = False
workbook = ExcelApp.Workbooks.Open(r'C:\Users\aju.mathew.thomas\Desktop\PBC\Pepsi\PBC\Performance Reports\2019\PPT\Summary2.xlsx')
worksheet = ExcelApp.worksheets("Summary")
for name in NameMa
excelrange = worksheet.Range("A2:R24")
excelrange.Copy()
PptApp = win32com.client.Dispatch("Powerpoint.Application")
PptApp.Visible = True
PPtPresentation = PptApp.Presentations.Open(r'C:\Users\aju.mathew.thomas\Desktop\PBC\Pepsi\PBC\Performance Reports\2019\PPT\Performance Update1.pptx')
pptSlide = PPtPresentation.Slides.Add(1,10)
pptSlide.Shapes.Paste()
PPtPresentation.Save()

python excel powerpoint win32com python-pptx
1个回答
0
投票
© www.soinside.com 2019 - 2024. All rights reserved.