PPT处理控件Aspose.Slides最新功能发布!实现自主的跨平台3D引擎

PPT文档组件开发工具Aspose.Slides for .Net更新至v20.9,实现自主的跨平台3D引擎,在SVG中生成支持单个tspan的Id属性,修复保存.ppt文件时发生异常等诸多问题,欢迎下载体验。

(安装包仅提供部分功能,并设置限制,如需试用完整功能请申请免费授权)

情暖中秋,礼惠国庆!整合所有格式API处理控件Aspose永久授权火热促销中,新购享85折起!联系客服立马1分钟了解全部咨询!

具体更新内容

key 概述 类别
SLIDESNET-42081 在SVG中生成支持单个tspan的Id属性 增强功能
SLIDESNET-42123 保存.ppt文件时发生异常 Bug修复
SLIDESNET-42117 音频帧未通过VideoPlayerHtmlController导出为HTML Bug修复
SLIDESNET-42111 导出的PDF中缺少文本 Bug修复
SLIDESNET-42098 使用空数据生成树图图表的操作不正确。 Bug修复
SLIDESNET-42096 将生成的缩略图中的形状滑动为空 Bug修复
SLIDESNET-42094 组形状WriteAsSvg()-旋转丢失 Bug修复

更多更新修复请参考:【Aspose.Slides for .NET v20.9更新说明】

公共API更改

添加3D支持

在Aspose.Slides 20.9 中宣布了自己的跨平台3D引擎。新的3D引擎可以导出和栅格化具有3D效果的形状和文本。

在以前的版本中,已应用3D效果的“幻灯片”形状被渲染为平坦。但是,现在可以使用成熟的3D渲染形状。此外,现在可以通过Slides公共API创建具有3D效果的形状:

using (Presentation pres = new Presentation()){    IAutoShape shape = pres.Slides[0].Shapes.AddAutoShape(ShapeType.Rectangle, 200, 150, 200, 200);    shape.TextFrame.Text = "3D";    shape.TextFrame.Paragraphs[0].ParagraphFormat.DefaultPortionFormat.FontHeight = 64;     shape.ThreeDFormat.Camera.CameraType = CameraPresetType.OrthographicFront;    shape.ThreeDFormat.Camera.SetRotation(20, 30, 40);    shape.ThreeDFormat.LightRig.LightType = LightRigPresetType.Flat;    shape.ThreeDFormat.LightRig.Direction = LightingDirection.Top;    shape.ThreeDFormat.Material = MaterialPresetType.Powder;    shape.ThreeDFormat.ExtrusionHeight = 100;    shape.ThreeDFormat.ExtrusionColor.Color = Color.Blue;     pres.Slides[0].GetThumbnail(2, 2).Save("sample_3d.png");    pres.Save("sandbox_3d.pptx", SaveFormat.Pptx);}

渲染的缩略图如下所示:

PPT处理控件Aspose.Slides最新功能发布!实现自主的跨平台3D引擎

添加IBulletFormatEffectiveData.FillFormat属性

新的FillFormat属性已添加到IBulletFormatEffectiveData接口。使用此属性可以获取段落项目符 填充的有效值。

PPT处理控件Aspose.Slides最新功能发布!实现自主的跨平台3D引擎

下面的代码段演示了如何检索项目符 的填充有效数据:

using (Presentation pres = new Presentation("SomePresentation.pptx")){    // Assume that the first shape on the first slide is AutoShape with some text...    // Output information about text paragraphs' bullets    AutoShape autoShape = (AutoShape)pres.Slides[0].Shapes[0];    foreach (Paragraph para in autoShape.TextFrame.Paragraphs)    {        IBulletFormatEffectiveData bulletFormatEffective = para.ParagraphFormat.Bullet.GetEffective();        Console.WriteLine("Bullet type: " + bulletFormatEffective.Type);        if (bulletFormatEffective.Type != BulletType.None)        {            Console.WriteLine("Bullet fill type: " + bulletFormatEffective.FillFormat.FillType);            switch (bulletFormatEffective.FillFormat.FillType)            {                case FillType.Solid:                    Console.WriteLine("Solid fill color: " + bulletFormatEffective.FillFormat.SolidFillColor);                    break;                case FillType.Gradient:                    Console.WriteLine("Gradient stops count: " + bulletFormatEffective.FillFormat.GradientFormat.GradientStops.Count);                    foreach (IGradientStopEffectiveData gradStop in bulletFormatEffective.FillFormat.GradientFormat.GradientStops)                        Console.WriteLine(gradStop.Position + ": " + gradStop.Color);                    break;                case FillType.Pattern:                    Console.WriteLine("Pattern style: " + bulletFormatEffective.FillFormat.PatternFormat.PatternStyle);                    Console.WriteLine("Fore color: " + bulletFormatEffective.FillFormat.PatternFormat.ForeColor);                    Console.WriteLine("Back color: " + bulletFormatEffective.FillFormat.PatternFormat.BackColor);                    break;            }        }        Console.WriteLine();    }}

Aspose.Slides.Export.Web成员应用程序示例

下面的代码示例演示了Aspose.Slides.Export.Web成员的实际应用。它代表Presentation类的扩展,该扩展创建并设置一个WebDocument对象,该对象将演示文稿保存为HTML。请注意,转换模板未包含在示例中。

public static class PresentationExtensions{    public static WebDocument ToSinglePageWebDocument(        this Presentation pres,        WebDocumentOptions options,        string templatesPath,        string outputPath)    {        WebDocument document = new WebDocument(options);        SetGlobals(document, options, outputPath);        document.Global.Put("slidesPath", outputPath);        document.Global.Put("stylesPath", outputPath);        document.AddCommonInputOutput(options, templatesPath, outputPath, pres);        return document;    }     private static void SetGlobals(WebDocument document, WebDocumentOptions options, string outputPath)    {        string imagesPath = Path.Combine(outputPath, "images");        string fontsPath = Path.Combine(outputPath, "fonts");        string mediaPath = Path.Combine(outputPath, "media");        document.Global.Put("slideMargin", 10);        document.Global.Put("embedImages", options.EmbedImages);        document.Global.Put("imagesPath", imagesPath);        document.Global.Put("fontsPath", fontsPath);        document.Global.Put("mediaPath", mediaPath);    }     private static void AddCommonInputOutput(this WebDocument document, WebDocumentOptions options, string templatesPath, string outputPath, Presentation pres)    {        string stylesPath = document.Global.Get<string>("stylesPath");        document.Input.AddTemplate<Presentation>("styles-pres", Path.Combine(templatesPath, @"stylespres.css"));        document.Input.AddTemplate<MasterSlide>("styles-master", Path.Combine(templatesPath, @"stylesmaster.css"));        document.Input.AddTemplate<Presentation>("index", Path.Combine(templatesPath, "index.html"));        document.Input.AddTemplate<Slide>("slide", Path.Combine(templatesPath, "slide.html"));        document.Input.AddTemplate<AutoShape>("autoshape", Path.Combine(templatesPath, "autoshape.html"));        document.Input.AddTemplate<TextFrame>("textframe", Path.Combine(templatesPath, "textframe.html"));        document.Input.AddTemplate<Paragraph>("paragraph", Path.Combine(templatesPath, "paragraph.html"));        document.Input.AddTemplate<Paragraph>("bullet", Path.Combine(templatesPath, "bullet.html"));        document.Input.AddTemplate<Portion>("portion", Path.Combine(templatesPath, "portion.html"));        document.Input.AddTemplate<VideoFrame>("videoframe", Path.Combine(templatesPath, "videoframe.html"));        document.Input.AddTemplate<PictureFrame>("pictureframe", Path.Combine(templatesPath, "pictureframe.html"));        document.Input.AddTemplate<Table>("table", Path.Combine(templatesPath, "table.html"));        document.Input.AddTemplate<Shape>("shape", Path.Combine(templatesPath, "shape.html"));        document.Output.Add(Path.Combine(outputPath, "index.html"), "index", pres);        document.Output.Add(Path.Combine(stylesPath, "pres.css"), "styles-pres", pres);        document.Output.Add(Path.Combine(stylesPath, "master.css"), "styles-master", (MasterSlide)pres.Masters[0]);        if (!options.EmbedImages)        {            string imagesPath = document.Global.Get<string>("imagesPath");            document.AddImagesOutput(imagesPath, pres);        }    }     private static void AddImagesOutput(this WebDocument document, string outputPath, Presentation pres)    {        for (int index = 0; index < pres.Images.Count; index++)        {            IPPImage image = pres.Images[index];            string path;            string ext;            if (image.ContentType == "image/x-emf"                || image.ContentType == "image/x-wmf") //save metafile as PNG to make it supported by various browsers             {                ext = "png";                path = Path.Combine(outputPath, string.Format("image{0}.{1}", index, ext));                var bitmap = ImageHelper.MetafileToBitmap(image);                document.Output.Add(path, new ThumbnailOutputFile(bitmap), image);                continue;            }            ext = MimeTypesMap.GetExtension(image.ContentType);            path = Path.Combine(outputPath, string.Format("image{0}.{1}", index, ext));            document.Output.Add(path, image);        }    }}

还想要更多吗可以点击阅读【2020 · Aspose最新资源整合】查找需要的教程资源。如果您有任何疑问或需求,请随时加入Aspose技术交流群,我们很高兴为您提供查询和咨询
标签:

声明:本站部分文章及图片源自用户投稿,如本站任何资料有侵权请您尽早请联系jinwei@zod.com.cn进行处理,非常感谢!

上一篇 2020年8月24日
下一篇 2020年8月24日

相关推荐

发表回复

登录后才能评论