Extracting images from pptx with apache poi

后端 未结 2 1403
遇见更好的自我
遇见更好的自我 2020-12-12 05:31

I\'m trying to extract slides from a ppt file with Apache POI, there is no problem in that, but now I intend to open pptx files and do the same, do

2条回答
  •  鱼传尺愫
    2020-12-12 05:49

    Here's the way to do it in VBS, Maybe you can convert :

    Sub SaveAllPictures()
        Dim ap As Presentation: Set ap = ActivePresentation
        Dim savePath As String
        savePath = "C:\Users\me\Desktop\files\"
        Dim i As Integer
        Dim sl As Slide
        Dim sh As Shape
        For Each sl In ap.Slides
            For Each sh In sl.Shapes
                If sh.Type = msoPicture Then
                    sh.Export PathName:=savePath & sh.Name & CStr(i) & ".png", Filter:=ppShapeFormatPNG
                    i = i + 1
                End If
            Next
        Next
    End Sub
    

提交回复
热议问题