本文介绍了如何从power point文档中提取图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从pptx文档中提取图像并将其保存在我的桌面上

导入Microsoft.Office.Interop.PowerPoint 

公共类Form1

Private Sub Button1_Click(ByVal sender As System.Object,ByVal e As System.EventArgs)Handles Button1.Click
Dim ppt As New Presentation()
ppt.LoadFromFile( Desktop\test.pptx)

For i As Integer = 0 to ppt.Images.Count - 1
Dim image As Image = ppt.Images(i).Image
image.Save(String.Format(Desktop \Images {0} .jpg,i))
Next
End Sub
End Class







但我在这行中有错误



 Dim ppt As New Presentation()





不能申报ppt





错误1'Microsoft.Office.Interop.PowerPoint.PresentationClass.Friend Sub New()'在此上下文中无法访问,因为它是'Friend 
解决方案

i want to extract image from pptx document and save it in my desktop

Imports Microsoft.Office.Interop.PowerPoint

Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim ppt As New Presentation()
        ppt.LoadFromFile("Desktop\test.pptx")

        For i As Integer = 0 To ppt.Images.Count - 1
            Dim image As Image = ppt.Images(i).Image
            image.Save(String.Format("Desktop\Images{0}.jpg", i))
        Next
    End Sub
End Class




but i have error in this line

Dim ppt As New Presentation()



cannot declare ppt


Error	1	'Microsoft.Office.Interop.PowerPoint.PresentationClass.Friend Sub New()' is not accessible in this context because it is 'Friend'.
解决方案

这篇关于如何从power point文档中提取图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-31 09:12