专业的编程技术博客社区

网站首页 > 博客文章 正文

Aspose.Slides for .NET v19.6发布上线!| 附下载

baijin 2024-09-11 00:51:42 博客文章 7 ℃ 0 评论

Aspose.Slides for .NET是一个独特的演示处理API,它允许应用程序读取、写入、修改和转换PowerPoint演示文稿。作为一个独立的API,它提供了管理PowerPoint关键功能的功能,如管理文本、形状、表格和动画、向幻灯片添加音频和视频、预览幻灯片等,而不需要Microsoft PowerPoint。

Aspose.Slides for .NET更新至v19.6,新增支持从演示文稿中提取VBA宏、为文本框设置锁定宽高比等多项功能!

Aspose.Slides for .NET v19.6的API更改


▲添加了BackgroundEffectiveData类和IBackgroundEffectiveData接口

已经添加了Aspose.Slides.IBackgroundEffectiveData接口和Aspose.Slides.BackgroundEffectiveData类的实现。它们代表幻灯片的有效背景,包含有效填充格式和有效效果格式的信息。

▲添加了IBaseSlide.CreateBackgroundEffective方法

CreateBackgroundEffective方法已添加到IBaseSlide接口和BaseSlide类中。使用此方法可以获得幻灯片背景的有效值。

以下示例代码输出有效的背景填充:

 Presentation pres = new Presentation( "SamplePresentation.pptx" );
IBackgroundEffectiveData effBackground = pres.Slides[ 0 ].CreateBackgroundEffective();
if (effBackground.FillFormat.FillType == FillType.Solid)
 Console.WriteLine( "Fill color: " + effBackground.FillFormat.SolidFillColor);
else
 Console.WriteLine( "Fill type: " + effBackground.FillFormat.FillType);

▲添加了新的IProgressCallback接口

新的IProgressCallback接口已添加到ISaveOptions接口和SaveOptions抽象类中。IProgressCallback接口表示用于以百分比保存进度更新的回调对象。

以下示例代码输出有效的背景填充:

 public interface IProgressCallback
{
 ////// Reports a progress update.
 //////A value of the updated progress.void Reporting(double progressValue);
}

下面的代码片段显示了如何使用IProgressCallback接口:

 using (Presentation presentation = new Presentation(fileName))
{
 ISaveOptions saveOptions = new PdfOptions();
 saveOptions.ProgressCallback = new ExportProgressHandler();
 presentation.Save(pdfFileName, SaveFormat.Pdf, saveOptions);
}
 class ExportProgressHandler : IProgressCallback
{
 public void Reporting(double progressValue)
 {
 // Use progress percentage value here
 }
}

▲Pot值已添加到LoadFormat和SaveFormat枚举中

新的Pot值已添加到Aspose.Slides.LoadFormat和Aspose.Slides.SaveFormat枚举中。此值表示Microsoft PowerPoint 97-2003演示文稿模板格式。

▲增加了对作为BLOB的管理映像的支持

从版本19.6开始,Aspose.Slides支持将演示图像作为BLOB进行管理。此外,新方法已添加到IImageCollection接口和ImageCollection类,以支持将大图像添加为流以将它们视为BLOB:

IPPImage AddImage(Stream stream,LoadingStreamBehavior loadingStreamBehavior);

此示例演示如何包含大型BLOB(图像)并防止高内存消耗。

 static void AddingNewBlobImageToPresentation()
{
 // supposed we have the large image file we want to include into the presentation
 const string pathToLargeImage = "largeImage.png" ;
 
 // create a new presentation which will contain this image
 using (Presentation pres = new Presentation())
 {
 using (FileStream fileStream = new FileStream(pathToLargeImage, FileMode.Open))
 {
 // let's add the image to the presentation - we choose KeepLocked behavior, because we not
 // have an intent to access the "largeImage.png" file.
 IPPImage img = pres.Images.AddImage(fileStream, LoadingStreamBehavior.KeepLocked);
 pres.Slides[ 0 ].Shapes.AddPictureFrame(ShapeType.Rectangle, 0 , 0 , 300 , 200 , img);
 
 // save the presentation. Despite that the output presentation will be
 // large, the memory consumption will be low the whole lifetime of the pres object
 pres.Save( "presentationWithLargeImage.pptx" , SaveFormat.Pptx);
 }
 }
}

获取更新详细说明或下载链接可点击下方“了解更多”查看

↓↓↓


Tags:

本文暂时没有评论,来添加一个吧(●'◡'●)

欢迎 发表评论:

最近发表
标签列表