PowerPoint / PHP - What tools allow for generating a data driven merged template (pptx) with embedded macros?

对着背影说爱祢 提交于 2019-12-12 06:13:13

问题


I want to generate a Powerpoint Chart with graphs that are dependent on dynamic data from PHP.

I have tried OpenTBS but it does not recognize the template because it is a pptm (macro enabled) file.

How do I go about dynamically specifying the data to merge with a template that contains complex graphs and macros like below?

Embedded Excel Data

Chart in PowerPoint slide

Sample Color Subroutine in VBA

Sub ColorByValue()
        'Assume we have only one slide, at slide 1:
        Set sld = ActivePresentation.Slides(1)
        'Assume the Chart is the second shape, modify if needed
        Set shp = sld.Shapes(2)
        'Handle the chart
        Set cht = shp.Chart
        'Handle the ChartData
        Set chtData = cht.ChartData


      Dim likelihood As Long
      Dim vPatterns As Variant
      Dim consequence As Long
      Dim vValues As Variant
      Dim point As Long

       Set rPatterns = chtData.Workbook.Worksheets(1).Range("B2:F6")

       For likelihood = 1 To 5
       With cht.SeriesCollection(likelihood)
          For consequence = 1 To 5
              .Points(consequence).Format.Fill.BackColor.RGB = rPatterns.Cells(likelihood, consequence).Interior.Color
          Next
      End With
      Next
    End Sub

来源:https://stackoverflow.com/questions/44771946/powerpoint-php-what-tools-allow-for-generating-a-data-driven-merged-template

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!