How to modify the master:Aspose.slide batch replaces master background images-PPT tutorial免费ppt模版下载-道格办公

Aspose.slide batch replaces master background images


I received a business requirement and needed to replace the background image of the pptx master in batches. If done manually, each file would take half an hour to an hour, and each issue would cost more than 100. Each issue would cost an additional 10 After a few days, let’s take a look at how to optimize efficiently.

Directly use aspose.slide. The core function is to use the replacement function of the aspose master.

The core code is just these lines

Presentation pres = null;
try
{
pres = new Presentation(prespath);
IS slide = pres.Slides[0];
IMasterSlide masterSlide = slide.LayoutSlide.MasterSlide;< br>IPPImage image = pres.Images.AddImage(image2);

IPictureFrame ipp = masterSlide.Shapes.AddPictureFrame(ShapeType.Rectangle, 0, 0, pres.SlideSize.Size.Width, pres.SlideSize.Size.Height, image);

string newfile = prespath.Replace(" .pptx", "_replaced.pptx");
pres.Save(newfile, Aspose.Slides.Export.SaveFormat.Pptx);

}catch(Exception e)
{
throw;
}
finally
{
if(pres !=null) pres.Dispose();

}

Look at the finished product.

It is more convenient to use, 1/2/3 is enough. pptx can be replaced normally, but if there are problems with pptx itself, such as missing fonts, etc., these problems need to be dealt with manually before tools can be used for batch replacement.

Articles are uploaded by users and are for non-commercial browsing only. Posted by: Lomu, please indicate the source: https://www.daogebangong.com/en/articles/detail/Aspose-slide-pi-liang-ti-huan-mu-ban-bei-jing-tu.html

Like (810)
Reward 支付宝扫一扫 支付宝扫一扫
single-end

Related Suggestion