Aspose.Slides for .NET v19.6发布上线!支持从演示文稿中提取VBA宏 | 附下载

龙成仁
2023-12-01

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

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

【下载Aspose.Slides for .NET最新试用版】

具体更新内容

key概述类别
SLIDESNET-40010在图表中设置外部工作簿的外部工作簿路径调查
SLIDESNET-41093将演示文稿另存为内存流问题调查
SLIDESNET-40958新增将演示文稿另存为HTML时,使每个页面都自给自足的选项新功能
SLIDESNET-40672支持从演示文稿中提取VBA宏新功能
SLIDESNET-34681支持PDF转换百分比的进展新功能
SLIDESNET-41101实现PDF转换百分比的进度新功能
SLIDESNET-41142支持设置锁定长宽比的文本框新功能
SLIDESNET-41092IColorFormat.Color不返回有效颜色新功能
SLIDESNET-31569在PowerPoint图表中添加自定义行新功能
SLIDESNET-30385使用编辑数据自动刷新图表新功能
SLIDESNET-16733Fusion Asrts支持Aspose.Slides新功能
SLIDESNET-18215支持Aspose.Slides中的ComponentArt图表对象新功能
SLIDESNET-12438SmartArt和图表对象实现PPTX -> PDF增强
SLIDESNET-41149生成框和晶须图表增强
SLIDESNET-41090PPTX文件未正确转换为PDFBug修复

更多更新细则请参考:【Aspose.Slides for .NET v19.6更新说明】

 

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);
        }
    }
}

ASPOSE技术交流QQ群(642018183)已开通,各类资源及时分享,欢迎交流讨论!

 类似资料: