- 积分
- 119
- 在线时间
- 21 小时
- 主题
- 22
- 注册时间
- 2019-10-24
- 帖子
- 24
- 最后登录
- 2021-3-9
- 帖子
- 24
- 软币
- 353
- 在线时间
- 21 小时
- 注册时间
- 2019-10-24
|
Aspose.Slides for .NET是一个独特的演示处理API,它允许应用程序读取、写入、修改和转换PowerPoint演示文稿。作为一个独立的API,它提供了管理PowerPoint关键功能的功能,如管理文本、形状、表格和动画、向幻灯片添加音频和视频、预览幻灯片等,而不需要Microsoft PowerPoint。
Aspose.Slides for .NET迎来2020年9月更新v20.9,实现自主的跨平台3D引擎,在SVG中生成支持单个tspan的Id属性,修复保存.ppt文件时发生异常等诸多问题。(下载最新版,安装包仅提供部分功能,并设置限制,如需试用完整功能请申请免费授权)
具体更新内容 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修复 | 公共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);} 渲染的缩略图如下所示:
添加IBulletFormatEffectiveData.FillFormat属性
新的FillFormat属性已添加到IBulletFormatEffectiveData接口。使用此属性可以获取段落项目符号填充的有效值。
下面的代码段演示了如何检索项目符号的填充有效数据:
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, @"styles\pres.css")); document.Input.AddTemplate<MasterSlide>("styles-master", Path.Combine(templatesPath, @"styles\master.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); } }} 如果您有任何疑问或需求,请随时加入Aspose技术交流群(642018183),我们很高兴为您提供查询和咨询。
|
|