如何使用Aspose.Slides提取幻灯片中的图像
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了如何使用Aspose.Slides提取幻灯片中的图像相关的知识,希望对你有一定的参考价值。
参考技术A String path = @"..\..\..\";//Accessing the presentation
PresentationEx pres = new PresentationEx(path+"demo.pptx");
ImageEx img = null;
int slideIndex = 0;
for (int i = 0; i < pres.Slides.Count; i++)
slideIndex++;
//Accessing the first slide
SlideEx sl = pres.Slides[i];
System.Drawing.Imaging.ImageFormat Format = System.Drawing.Imaging.ImageFormat.Jpeg;
for (int j = 0; j < sl.Shapes.Count; j++)
// Accessing the shape with picture
Aspose.Slides.Pptx.ShapeEx sh = sl.Shapes[j];
if (sh is AutoShapeEx)
AutoShapeEx ashp = (AutoShapeEx)sh;
if (ashp.FillFormat.FillType == FillTypeEx.Picture)
img = ashp.FillFormat.PictureFillFormat.Picture.Image;
else if (sh is PictureFrameEx)
PictureFrameEx pf = (PictureFrameEx)sh;
if (pf.FillFormat.FillType == FillTypeEx.Picture)
img = pf.PictureFormat.Picture.Image;
String ImageType = img.ContentType;
ImageType = ImageType.Remove(0, ImageType.IndexOf("/") + 1);
//
//Setting the desired picture format
switch (ImageType)
case "jpeg":
Format = System.Drawing.Imaging.ImageFormat.Jpeg;
break;
case "emf":
Format = System.Drawing.Imaging.ImageFormat.Emf;
break;
case "bmp":
Format = System.Drawing.Imaging.ImageFormat.Bmp;
break;
case "png":
Format = System.Drawing.Imaging.ImageFormat.Png;
break;
case "wmf":
Format = System.Drawing.Imaging.ImageFormat.Wmf;
break;
case "gif":
Format = System.Drawing.Imaging.ImageFormat.Gif;
break;
//
String ImagePath = path+"Image_";
img.Image.Save(ImagePath + "Slide_" + slideIndex.ToString() + "." + ImageType, Format);
本回答被提问者和网友采纳
如何把ppt中的swf提取出来??
别人做的ppt中有swf动画,如何把ppt中的swf提取出来,成为一个单独的swf文件??
如果你用的是高版本的offic(07或者是10),直接另存为网页形式,所有的东西就都可以用了 参考技术A 哪个PPT中的动画?能把PPT发过来看看么?以上是关于如何使用Aspose.Slides提取幻灯片中的图像的主要内容,如果未能解决你的问题,请参考以下文章