Публичное API и изменения, несовместимые с предыдущими версиями в Aspose.Slides для Java 15.10.0
Изменения в публичном API
API анимации серий графиков был добавлен в ISequence
В интерфейс com.aspose.slides.ISequence были добавлены новые 2 метода.
IEffect addEffect(IChart chart, int type, int index, int effectType, int subtype, int triggerType);
IEffect addEffect(IChart chart, int type, int seriesIndex, int categoriesIndex, int effectType, int subtype, int triggerType);
Эти методы предназначены для поддержки анимаций элементов графиков:
по сериям по категориям по элементам серий по элементам категорий
Были введены два новых перечисления EffectChartMajorGroupingType и EffectChartMinorGroupingType, относящихся к анимации элементов графиков.
Для добавления анимации серий к графику может использоваться следующий код:
Presentation pres = new Presentation(inFileName);
try {
ISlide slide = pres.getSlides().get_Item(0);
IShapeCollection shapes = slide.getShapes();
IChart chart = (IChart) shapes.get_Item(0);
slide.getTimeline().getMainSequence().addEffect(chart, EffectType.Fade, EffectSubtype.None,
EffectTriggerType.AfterPrevious);
((Sequence)slide.getTimeline().getMainSequence()).addEffect(chart,
EffectChartMajorGroupingType.BySeries, 0,
EffectType.Appear, EffectSubtype.None, EffectTriggerType.AfterPrevious);
((Sequence)slide.getTimeline().getMainSequence()).addEffect(chart,
EffectChartMajorGroupingType.BySeries, 1,
EffectType.Appear, EffectSubtype.None, EffectTriggerType.AfterPrevious);
((Sequence)slide.getTimeline().getMainSequence()).addEffect(chart,
EffectChartMajorGroupingType.BySeries, 2,
EffectType.Appear, EffectSubtype.None, EffectTriggerType.AfterPrevious);
((Sequence)slide.getTimeline().getMainSequence()).addEffect(chart,
EffectChartMajorGroupingType.BySeries, 3,
EffectType.Appear, EffectSubtype.None, EffectTriggerType.AfterPrevious);
pres.save(outFileName, SaveFormat.Pptx);
} finally {
if(pres != null) pres.dispose();
}
Анимация категорий:
Presentation pres = new Presentation(inFileName);
try
{
ISlide slide = pres.getSlides().get_Item(0);
IShapeCollection shapes = slide.getShapes();
IChart chart = (IChart) shapes.get_Item(0);
slide.getTimeline().getMainSequence().addEffect(chart, EffectType.Fade, EffectSubtype.None,
EffectTriggerType.AfterPrevious);
((Sequence)slide.getTimeline().getMainSequence()).addEffect(chart,
EffectChartMajorGroupingType.ByCategory, 0,
EffectType.Appear, EffectSubtype.None, EffectTriggerType.AfterPrevious);
((Sequence)slide.getTimeline().getMainSequence()).addEffect(chart,
EffectChartMajorGroupingType.ByCategory, 1,
EffectType.Appear, EffectSubtype.None, EffectTriggerType.AfterPrevious);
((Sequence)slide.getTimeline().getMainSequence()).addEffect(chart,
EffectChartMajorGroupingType.ByCategory, 2,
EffectType.Appear, EffectSubtype.None, EffectTriggerType.AfterPrevious);
((Sequence)slide.getTimeline().getMainSequence()).addEffect(chart,
EffectChartMajorGroupingType.ByCategory, 3,
EffectType.Appear, EffectSubtype.None, EffectTriggerType.AfterPrevious);
pres.save(outFileName, SaveFormat.Pptx);
} finally {
if(pres != null) pres.dispose();
}
Анимация элементов серий:
Presentation pres = new Presentation(inFileName);
try
{
ISlide slide = pres.getSlides().get_Item(0);
IShapeCollection shapes = slide.getShapes();
IChart chart = (IChart) shapes.get_Item(0);
slide.getTimeline().getMainSequence().addEffect(chart, EffectType.Fade, EffectSubtype.None,
EffectTriggerType.AfterPrevious);
((Sequence)slide.getTimeline().getMainSequence()).addEffect(chart,
EffectChartMinorGroupingType.ByElementInSeries, 0, 0,
EffectType.Appear, EffectSubtype.None, EffectTriggerType.AfterPrevious);
((Sequence)slide.getTimeline().getMainSequence()).addEffect(chart,
EffectChartMinorGroupingType.ByElementInSeries, 0, 1,
EffectType.Appear, EffectSubtype.None, EffectTriggerType.AfterPrevious);
((Sequence)slide.getTimeline().getMainSequence()).addEffect(chart,
EffectChartMinorGroupingType.ByElementInSeries, 0, 2,
EffectType.Appear, EffectSubtype.None, EffectTriggerType.AfterPrevious);
((Sequence)slide.getTimeline().getMainSequence()).addEffect(chart,
EffectChartMinorGroupingType.ByElementInSeries, 0, 3,
EffectType.Appear, EffectSubtype.None, EffectTriggerType.AfterPrevious);
((Sequence)slide.getTimeline().getMainSequence()).addEffect(chart,
EffectChartMinorGroupingType.ByElementInSeries, 1, 0,
EffectType.Appear, EffectSubtype.None, EffectTriggerType.AfterPrevious);
((Sequence)slide.getTimeline().getMainSequence()).addEffect(chart,
EffectChartMinorGroupingType.ByElementInSeries, 1, 1,
EffectType.Appear, EffectSubtype.None, EffectTriggerType.AfterPrevious);
((Sequence)slide.getTimeline().getMainSequence()).addEffect(chart,
EffectChartMinorGroupingType.ByElementInSeries, 1, 2,
EffectType.Appear, EffectSubtype.None, EffectTriggerType.AfterPrevious);
((Sequence)slide.getTimeline().getMainSequence()).addEffect(chart,
EffectChartMinorGroupingType.ByElementInSeries, 1, 3,
EffectType.Appear, EffectSubtype.None, EffectTriggerType.AfterPrevious);
((Sequence)slide.getTimeline().getMainSequence()).addEffect(chart,
EffectChartMinorGroupingType.ByElementInSeries, 2, 0,
EffectType.Appear, EffectSubtype.None, EffectTriggerType.AfterPrevious);
((Sequence)slide.getTimeline().getMainSequence()).addEffect(chart,
EffectChartMinorGroupingType.ByElementInSeries, 2, 1,
EffectType.Appear, EffectSubtype.None, EffectTriggerType.AfterPrevious);
((Sequence)slide.getTimeline().getMainSequence()).addEffect(chart,
EffectChartMinorGroupingType.ByElementInSeries, 2, 2,
EffectType.Appear, EffectSubtype.None, EffectTriggerType.AfterPrevious);
((Sequence)slide.getTimeline().getMainSequence()).addEffect(chart,
EffectChartMinorGroupingType.ByElementInSeries, 2, 3,
EffectType.Appear, EffectSubtype.None, EffectTriggerType.AfterPrevious);
pres.save(outFileName, SaveFormat.Pptx);
} finally {
if(pres != null) pres.dispose();
}
Анимация элементов категорий:
Presentation pres = new Presentation(inFileName);
try
{
ISlide slide = pres.getSlides().get_Item(0);
IShapeCollection shapes = slide.getShapes();
IChart chart = (IChart) shapes.get_Item(0);
slide.getTimeline().getMainSequence().addEffect(chart, EffectType.Fade, EffectSubtype.None,
EffectTriggerType.AfterPrevious);
((Sequence)slide.getTimeline().getMainSequence()).addEffect(chart,
EffectChartMinorGroupingType.ByElementInCategory, 0, 0,
EffectType.Appear, EffectSubtype.None, EffectTriggerType.AfterPrevious);
((Sequence)slide.getTimeline().getMainSequence()).addEffect(chart,
EffectChartMinorGroupingType.ByElementInCategory, 0, 1,
EffectType.Appear, EffectSubtype.None, EffectTriggerType.AfterPrevious);
((Sequence)slide.getTimeline().getMainSequence()).addEffect(chart,
EffectChartMinorGroupingType.ByElementInCategory, 0, 2,
EffectType.Appear, EffectSubtype.None, EffectTriggerType.AfterPrevious);
((Sequence)slide.getTimeline().getMainSequence()).addEffect(chart,
EffectChartMinorGroupingType.ByElementInCategory, 0, 3,
EffectType.Appear, EffectSubtype.None, EffectTriggerType.AfterPrevious);
((Sequence)slide.getTimeline().getMainSequence()).addEffect(chart,
EffectChartMinorGroupingType.ByElementInCategory, 1, 0,
EffectType.Appear, EffectSubtype.None, EffectTriggerType.AfterPrevious);
((Sequence)slide.getTimeline().getMainSequence()).addEffect(chart,
EffectChartMinorGroupingType.ByElementInCategory, 1, 1,
EffectType.Appear, EffectSubtype.None, EffectTriggerType.AfterPrevious);
((Sequence)slide.getTimeline().getMainSequence()).addEffect(chart,
EffectChartMinorGroupingType.ByElementInCategory, 1, 2,
EffectType.Appear, EffectSubtype.None, EffectTriggerType.AfterPrevious);
((Sequence)slide.getTimeline().getMainSequence()).addEffect(chart,
EffectChartMinorGroupingType.ByElementInCategory, 1, 3,
EffectType.Appear, EffectSubtype.None, EffectTriggerType.AfterPrevious);
((Sequence)slide.getTimeline().getMainSequence()).addEffect(chart,
EffectChartMinorGroupingType.ByElementInCategory, 2, 0,
EffectType.Appear, EffectSubtype.None, EffectTriggerType.AfterPrevious);
((Sequence)slide.getTimeline().getMainSequence()).addEffect(chart,
EffectChartMinorGroupingType.ByElementInCategory, 2, 1,
EffectType.Appear, EffectSubtype.None, EffectTriggerType.AfterPrevious);
((Sequence)slide.getTimeline().getMainSequence()).addEffect(chart,
EffectChartMinorGroupingType.ByElementInCategory, 2, 2,
EffectType.Appear, EffectSubtype.None, EffectTriggerType.AfterPrevious);
((Sequence)slide.getTimeline().getMainSequence()).addEffect(chart,
EffectChartMinorGroupingType.ByElementInCategory, 2, 3,
EffectType.Appear, EffectSubtype.None, EffectTriggerType.AfterPrevious);
pres.save(outFileName, SaveFormat.Pptx);
} finally {
if(pres != null) pres.dispose();
}
Добавление нового com.aspose.slides.VideoPlayerHtmlController для поддержки экспорта медиафайлов в HTML
К публичному классу com.aspose.slides.VideoPlayerHtmlController был добавлен. С помощью экземпляра этого класса пользователь может экспортировать видео и аудиофайлы в HTML.
Конструкторы VideoPlayerHtmlController принимают следующие параметры:
path: Путь, по которому будут генерироваться видео и аудиофайлы fileName: Имя HTML файла baseUri: Базовый URI, который будет использоваться для генерации ссылок
Пример использования:
Presentation pres = new Presentation("пример.pptx");
try
{
final String path = "путь";
final String fileName = "видео.html";
final String baseUri = "http://www.example.com/";
VideoPlayerHtmlController controller = new VideoPlayerHtmlController(path, fileName, baseUri);
HtmlOptions htmlOptions = new HtmlOptions(controller);
SVGOptions svgOptions = new SVGOptions(controller);
htmlOptions.setHtmlFormatter(HtmlFormatter.createCustomFormatter(controller));
htmlOptions.setSlideImageFormat(SlideImageFormat.svg(svgOptions));
pres.save(path + fileName, SaveFormat.Html, htmlOptions);
} finally {
if(pres != null) pres.dispose();
}