Aspose.Slides for .NET 15.10.0 的公共 API 和不兼容的更改
Contents
[
Hide
]
公共 API 更改
新增 VideoPlayerHtmlController 支持将媒体文件导出为 HTML
新的公共类 VideoPlayerHtmlController 已添加到 Aspose.Slides.Export 命名空间。通过此类的实例,用户可以将视频和音频文件导出为 HTML。 VideoPlayerHtmlController 构造函数接受以下参数:
path: 生成视频和音频文件的路径 fileName: HTML 文件的名称
baseUri: 用于生成链接的基础 URI 使用示例:
using (Presentation pres = new Presentation("example.pptx"))
{
const string path = "path";
const string fileName = "video.html";
const string baseUri = "http://www.example.com/";
VideoPlayerHtmlController controller = new VideoPlayerHtmlController(path: path, fileName: fileName, baseUri: baseUri);
HtmlOptions htmlOptions = new HtmlOptions(controller);
SVGOptions svgOptions = new SVGOptions(controller);
htmlOptions.HtmlFormatter = HtmlFormatter.CreateCustomFormatter(controller);
htmlOptions.SlideImageFormat = SlideImageFormat.Svg(svgOptions);
pres.Save(Path.Combine(path, fileName), SaveFormat.Html, htmlOptions);
}
已添加图表系列动画 API
在 Aspose.Slides.Animation.ISequence 接口中新增了 2 方法。
IEffect AddEffect(IChart chart, EffectChartMajorGroupingType type, int index, EffectType effectType, EffectSubtype subtype, EffectTriggerType triggerType);
IEffect AddEffect(IChart chart, EffectChartMinorGroupingType type, int seriesIndex, int categoriesIndex, EffectType effectType, EffectSubtype subtype, EffectTriggerType triggerType);
这些方法旨在支持图表元素动画: 按系列 按类别 按系列元素 按类别元素
引入了两个新的枚举 EffectChartMajorGroupingType 和 EffectChartMinorGroupingType,与图表元素动画相关。
要向图表添加系列动画,可以使用以下代码:
using (Presentation pres = new Presentation(inFileName))
{
var slide = pres.Slides[0] as Slide;
var shapes = slide.Shapes as ShapeCollection;
var chart = shapes[0] as IChart;
slide.Timeline.MainSequence.AddEffect(chart, EffectType.Fade, EffectSubtype.None,
EffectTriggerType.AfterPrevious);
((Sequence)slide.Timeline.MainSequence).AddEffect(chart,
EffectChartMajorGroupingType.BySeries, 0,
EffectType.Appear, EffectSubtype.None, EffectTriggerType.AfterPrevious);
((Sequence)slide.Timeline.MainSequence).AddEffect(chart,
EffectChartMajorGroupingType.BySeries, 1,
EffectType.Appear, EffectSubtype.None, EffectTriggerType.AfterPrevious);
((Sequence)slide.Timeline.MainSequence).AddEffect(chart,
EffectChartMajorGroupingType.BySeries, 2,
EffectType.Appear, EffectSubtype.None, EffectTriggerType.AfterPrevious);
((Sequence)slide.Timeline.MainSequence).AddEffect(chart,
EffectChartMajorGroupingType.BySeries, 3,
EffectType.Appear, EffectSubtype.None, EffectTriggerType.AfterPrevious);
pres.Save(outFileName, SaveFormat.Pptx);
}
类别动画:
using (Presentation pres = new Presentation(inFileName))
{
var slide = pres.Slides[0] as Slide;
var shapes = slide.Shapes as ShapeCollection;
var chart = shapes[0] as IChart;
slide.Timeline.MainSequence.AddEffect(chart, EffectType.Fade, EffectSubtype.None,
EffectTriggerType.AfterPrevious);
((Sequence)slide.Timeline.MainSequence).AddEffect(chart,
EffectChartMajorGroupingType.ByCategory, 0,
EffectType.Appear, EffectSubtype.None, EffectTriggerType.AfterPrevious);
((Sequence)slide.Timeline.MainSequence).AddEffect(chart,
EffectChartMajorGroupingType.ByCategory, 1,
EffectType.Appear, EffectSubtype.None, EffectTriggerType.AfterPrevious);
((Sequence)slide.Timeline.MainSequence).AddEffect(chart,
EffectChartMajorGroupingType.ByCategory, 2,
EffectType.Appear, EffectSubtype.None, EffectTriggerType.AfterPrevious);
((Sequence)slide.Timeline.MainSequence).AddEffect(chart,
EffectChartMajorGroupingType.ByCategory, 3,
EffectType.Appear, EffectSubtype.None, EffectTriggerType.AfterPrevious);
pres.Save(outFileName, SaveFormat.Pptx);
}
系列元素动画:
using (Presentation pres = new Presentation(inFileName))
{
var slide = pres.Slides[0] as Slide;
var shapes = slide.Shapes as ShapeCollection;
var chart = shapes[0] as IChart;
slide.Timeline.MainSequence.AddEffect(chart, EffectType.Fade, EffectSubtype.None,
EffectTriggerType.AfterPrevious);
((Sequence)slide.Timeline.MainSequence).AddEffect(chart,
EffectChartMinorGroupingType.ByElementInSeries, 0, 0,
EffectType.Appear, EffectSubtype.None, EffectTriggerType.AfterPrevious);
((Sequence)slide.Timeline.MainSequence).AddEffect(chart,
EffectChartMinorGroupingType.ByElementInSeries, 0, 1,
EffectType.Appear, EffectSubtype.None, EffectTriggerType.AfterPrevious);
((Sequence)slide.Timeline.MainSequence).AddEffect(chart,
EffectChartMinorGroupingType.ByElementInSeries, 0, 2,
EffectType.Appear, EffectSubtype.None, EffectTriggerType.AfterPrevious);
((Sequence)slide.Timeline.MainSequence).AddEffect(chart,
EffectChartMinorGroupingType.ByElementInSeries, 0, 3,
EffectType.Appear, EffectSubtype.None, EffectTriggerType.AfterPrevious);
((Sequence)slide.Timeline.MainSequence).AddEffect(chart,
EffectChartMinorGroupingType.ByElementInSeries, 1, 0,
EffectType.Appear, EffectSubtype.None, EffectTriggerType.AfterPrevious);
((Sequence)slide.Timeline.MainSequence).AddEffect(chart,
EffectChartMinorGroupingType.ByElementInSeries, 1, 1,
EffectType.Appear, EffectSubtype.None, EffectTriggerType.AfterPrevious);
((Sequence)slide.Timeline.MainSequence).AddEffect(chart,
EffectChartMinorGroupingType.ByElementInSeries, 1, 2,
EffectType.Appear, EffectSubtype.None, EffectTriggerType.AfterPrevious);
((Sequence)slide.Timeline.MainSequence).AddEffect(chart,
EffectChartMinorGroupingType.ByElementInSeries, 1, 3,
EffectType.Appear, EffectSubtype.None, EffectTriggerType.AfterPrevious);
((Sequence)slide.Timeline.MainSequence).AddEffect(chart,
EffectChartMinorGroupingType.ByElementInSeries, 2, 0,
EffectType.Appear, EffectSubtype.None, EffectTriggerType.AfterPrevious);
((Sequence)slide.Timeline.MainSequence).AddEffect(chart,
EffectChartMinorGroupingType.ByElementInSeries, 2, 1,
EffectType.Appear, EffectSubtype.None, EffectTriggerType.AfterPrevious);
((Sequence)slide.Timeline.MainSequence).AddEffect(chart,
EffectChartMinorGroupingType.ByElementInSeries, 2, 2,
EffectType.Appear, EffectSubtype.None, EffectTriggerType.AfterPrevious);
((Sequence)slide.Timeline.MainSequence).AddEffect(chart,
EffectChartMinorGroupingType.ByElementInSeries, 2, 3,
EffectType.Appear, EffectSubtype.None, EffectTriggerType.AfterPrevious);
pres.Save(outFileName, SaveFormat.Pptx);
}
类别元素动画:
using (Presentation pres = new Presentation(inFileName))
{
var slide = pres.Slides[0] as Slide;
var shapes = slide.Shapes as ShapeCollection;
var chart = shapes[0] as IChart;
slide.Timeline.MainSequence.AddEffect(chart, EffectType.Fade, EffectSubtype.None,
EffectTriggerType.AfterPrevious);
((Sequence)slide.Timeline.MainSequence).AddEffect(chart,
EffectChartMinorGroupingType.ByElementInCategory, 0, 0,
EffectType.Appear, EffectSubtype.None, EffectTriggerType.AfterPrevious);
((Sequence)slide.Timeline.MainSequence).AddEffect(chart,
EffectChartMinorGroupingType.ByElementInCategory, 0, 1,
EffectType.Appear, EffectSubtype.None, EffectTriggerType.AfterPrevious);
((Sequence)slide.Timeline.MainSequence).AddEffect(chart,
EffectChartMinorGroupingType.ByElementInCategory, 0, 2,
EffectType.Appear, EffectSubtype.None, EffectTriggerType.AfterPrevious);
((Sequence)slide.Timeline.MainSequence).AddEffect(chart,
EffectChartMinorGroupingType.ByElementInCategory, 0, 3,
EffectType.Appear, EffectSubtype.None, EffectTriggerType.AfterPrevious);
((Sequence)slide.Timeline.MainSequence).AddEffect(chart,
EffectChartMinorGroupingType.ByElementInCategory, 1, 0,
EffectType.Appear, EffectSubtype.None, EffectTriggerType.AfterPrevious);
((Sequence)slide.Timeline.MainSequence).AddEffect(chart,
EffectChartMinorGroupingType.ByElementInCategory, 1, 1,
EffectType.Appear, EffectSubtype.None, EffectTriggerType.AfterPrevious);
((Sequence)slide.Timeline.MainSequence).AddEffect(chart,
EffectChartMinorGroupingType.ByElementInCategory, 1, 2,
EffectType.Appear, EffectSubtype.None, EffectTriggerType.AfterPrevious);
((Sequence)slide.Timeline.MainSequence).AddEffect(chart,
EffectChartMinorGroupingType.ByElementInCategory, 1, 3,
EffectType.Appear, EffectSubtype.None, EffectTriggerType.AfterPrevious);
((Sequence)slide.Timeline.MainSequence).AddEffect(chart,
EffectChartMinorGroupingType.ByElementInCategory, 2, 0,
EffectType.Appear, EffectSubtype.None, EffectTriggerType.AfterPrevious);
((Sequence)slide.Timeline.MainSequence).AddEffect(chart,
EffectChartMinorGroupingType.ByElementInCategory, 2, 1,
EffectType.Appear, EffectSubtype.None, EffectTriggerType.AfterPrevious);
((Sequence)slide.Timeline.MainSequence).AddEffect(chart,
EffectChartMinorGroupingType.ByElementInCategory, 2, 2,
EffectType.Appear, EffectSubtype.None, EffectTriggerType.AfterPrevious);
((Sequence)slide.Timeline.MainSequence).AddEffect(chart,
EffectChartMinorGroupingType.ByElementInCategory, 2, 3,
EffectType.Appear, EffectSubtype.None, EffectTriggerType.AfterPrevious);
pres.Save(outFileName, SaveFormat.Pptx);
}