PowerPoint / PHP - What tools allow for generating

2019-08-25 10:36发布

问题:

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