API Pública y Cambios Incompatibles en Aspose.Slides para Java 15.10.0
Cambios en la API Pública
Se ha añadido la API de animación de series de gráficos a ISequence
Se han añadido 2 métodos nuevos a la interfaz com.aspose.slides.ISequence.
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);
Estos métodos están destinados a soportar las animaciones de los elementos del gráfico:
por series por categorías por elementos de series por elementos de categorías
Se introdujeron dos nuevos enums EffectChartMajorGroupingType y EffectChartMinorGroupingType relacionados con la animación de los elementos del gráfico.
Para añadir una animación de serie al gráfico se puede usar el siguiente código:
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();
}
Animación de categorías:
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();
}
Animación de elementos de serie:
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();
}
Animación de elementos de categorías:
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();
}
Se añadió com.aspose.slides.VideoPlayerHtmlController para soportar la exportación de archivos multimedia a HTML
Se ha añadido la nueva clase pública com.aspose.slides.VideoPlayerHtmlController. Usando la instancia de esta clase, el usuario puede exportar archivos de video y audio a HTML.
Los constructores de VideoPlayerHtmlController aceptan los siguientes parámetros:
path: La ruta donde se generarán los archivos de video y audio fileName: El nombre del archivo HTML baseUri: La URI base que se utilizará para generar enlaces
Ejemplo de uso:
Presentation pres = new Presentation("example.pptx");
try
{
final String path = "path";
final String fileName = "video.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();
}