我想知道是否可以自动从多个exel文件中提取数据,绘制图形并最终使用预先存在的模板以点的形式显示数据。我试过Python,但可以走得很远,现在有人建议使用VB。我将非常感谢你的帮助。 这是我的数据库看起来像
我有一个power-point模板,需要根据以下格式的excel文件中的数据进行更新 第二页(封面页后)标题中应该有以下内容 paint_for_yard1:Blue_light
在页面正文中:有一个表,当day_run_time最小时,它给出最大day_run_time和pigment_color)。 然后在同一页面中创建颜料颜色,日间运行时间,夜间运行时间图表。
由于我不是软件专家,我不确定Python或VB或组合是否会对我有所帮助。 任何建议将不胜感激。
由于 阿尼尔
答案 0 :(得分:1)
几乎所有'成长'的编程语言都可以。所以...... C#/ VB.NET / Python可以为你解决这个问题。
我想我会在PowerPoint模板中找到一个VBA脚本。 VBA专门用于Office,它可以与Excel通信。
答案 1 :(得分:0)
我使用Follow Sub从Excel文件创建一个powerpoint演示文稿。
Sub Gera_PPT(PFile As String, EFile As String, Plans As Collection)
'officevb.com
'PFile= PowerPoint Template empty powerPoint with Slide Master to presentation
'EFile = Excel File with Charts and Tables
'Plans = A collection with names of sheets to transpose
Dim rg As Range
'objetos usados para o powerpoint
Dim pptA As Object
Dim ppt As Object
Dim sld As Object
Debug.Print "passei 1"
If Not ValidaCaminho(PFile) Then
MsgBox "PowerPoint file not found!", vbInformation
Exit Sub
Else
Set pptA = CreateObject("PowerPoint.Application")
pptA.Visible = msoCTrue
'pptA.WindowState = -1
Set ppt = pptA.Presentations.Open(PFile)
End If
'objetos usados para o Excel
Dim ExA As Excel.Application
Dim wb As Excel.Workbook
Dim sht As Excel.Worksheet
If Not ValidaCaminho(EFile) Then
MsgBox "Excel file not found!!", vbInformation
Exit Sub
Else
Set ExA = New Excel.Application
'ExA.Visible = True
Set wb = Workbooks.Open(EFile, False)
End If
Debug.Print "passei 2"
'For Each sht In wb.Sheets
For i = 1 To Plans.Count
Set sht = wb.Sheets(Plans(i))
Select Case Left(sht.Name, 1)
'Debug.Print "passei 3"
'case is Table
Case "T"
Set sld = ppt.Slides.AddSlide(ppt.Slides.Count + 1, ppt.SlideMaster.CustomLayouts(2))
sld.Select
sld.Shapes.Placeholders(2).Select msoCTrue
Set rg = sht.Range("B4").CurrentRegion
rg.Copy
ppt.Windows(1).View.PasteSpecial ppPasteMetafilePicture
Case "G"
'Case is 1 Chart
If sht.ChartObjects.Count = 1 Then
Set sld = ppt.Slides.AddSlide(ppt.Slides.Count + 1, ppt.SlideMaster.CustomLayouts(2))
sld.Select
sld.Shapes.Placeholders(2).Select msoCTrue
sht.ChartObjects(1).Copy
ppt.Windows(1).View.PasteSpecial ppPasteMetafilePicture
' sld.Shapes.Placeholders.Item(1).TextFrame.TextRange.Text = sht.[A2]
Else
'Case is >1 Chart
Set sld = ppt.Slides.AddSlide(ppt.Slides.Count + 1, ppt.SlideMaster.CustomLayouts(4))
sld.Select
sht.Activate
sld.Shapes.Placeholders(1).TextFrame.TextRange.Text = sht.Range("A2").Value
sld.Shapes.Placeholders(2).Select msoCTrue
sht.ChartObjects(1).Copy
ppt.Windows(1).View.PasteSpecial ppPasteMetafilePicture
sld.Shapes.Placeholders(3).Select msoCTrue
sht.ChartObjects(2).Copy
ppt.Windows(1).View.PasteSpecial ppPasteMetafilePicture
End If
End Select
Next i
'Insert LastSlide
Set sld = ppt.Slides.AddSlide(ppt.Slides.Count + 1, ppt.SlideMaster.CustomLayouts(5))
wb.Close False
ExA.Quit
Strfile = Split(apoio.[PPTFile], "\")
ppt.SaveAs YourFilePath & "\" & Split(Strfile(UBound(Strfile)), ".")(0) & "-" & Format(Date, "ddmmyyyy")
pptA.Quit
MsgBox "Presentation created!", vbInformation
End Sub