Publiczny interfejs API i zmiany niekompatybilne wstecz w Aspose.Slides for Java 14.9.0

Zmiany publicznego API

Dodane metody do zastępowania obrazu na PPImage, IPPImage

Dodano nowe metody:

  • IPPImage.replaceImage(byte[] newImageData)
  • IPPImage.replaceImage(IPPImage newImage)

 Presentation presentation = new Presentation("presentation.pptx");

//Pierwszy sposób

byte[] imageData = // ...

presentation.getImages().get_Item(0).replaceImage(imageData);

//Drugi sposób

presentation.getImages().get_Item(1).replaceImage(

    presentation.getImages().get_Item(0));

presentation.save("presentation_out.pptx", SaveFormat.Pptx);

Dodane metody zapisywania slajdów z zachowaniem numerów stron

Dodano następujące metody:

  • void IPresentation.save(string fname, int[] slides, SaveFormat format);
  • void IPresentation.save(string fname, int[] slides, SaveFormat format, ISaveOption options);
  • void IPresentation.save(Stream stream, int[] slides, SaveFormat format);
  • void IPresentation.save(Stream stream, int[] slides, SaveFormat format, ISaveOption options);

Te metody umożliwiają zapisanie wybranych slajdów prezentacji w formatach PDF, XPS, TIFF, HTML. Tablica ‘slides’ pozwala określić numery stron, począwszy od 1.


 save(string fname, int\[\] slides, SaveFormat format);


 Presentation presentation = new Presentation(presentationFileName);

int[] slides = new int[] { 2, 3, 5 }; //Tablica pozycji slajdów

presentation.save(outFileName, slides, SaveFormat.Pdf);

Dodano wartość enum SmartArtLayoutType.Custom

Ten typ układu SmartArt reprezentuje diagram z niestandardowym szablonem. Niestandardowe diagramy mogą być ładowane wyłącznie z pliku prezentacji i nie mogą być tworzone za pomocą metody ShapeCollection.addSmartArt(x, y, width, height, SmartArtLayoutType.Custom)

Dodano klasę SmartArtShape i interfejs ISmartArtShape

Klasa Aspose.Slides.SmartArt.SmartArtShape (oraz jej interfejs Aspose.Slides.SmartArt.ISmartArtShape) zapewnia dostęp do poszczególnych kształtów w diagramie SmartArt. SmartArtShape może być używany do zmiany FillFormat, LineFormat, dodawania hiperłączy itp.

Przykład użycia:


 Presentation pres = new Presentation();

ISmartArt smart = pres.getSlides().get_Item(0).getShapes().addSmartArt(10, 10, 400, 300, SmartArtLayoutType.BasicBlockList);

ISmartArtNode node = smart.getAllNodes().get_Item(0);

for (ISmartArtShape shape : node.getShapes())

{

    shape.getFillFormat().setFillType(FillType.Solid);

    shape.getFillFormat().getSolidFillColor().setColor(Color.RED);

}

pres.save("out.pptx", SaveFormat.Pptx);

Dodano klasę SmartArtShapeCollection, interfejs ISmartArtShapeCollection oraz metodę ISmartArtNode.getShapes()

Klasa Aspose.Slides.SmartArt.SmartArtShapeCollection (oraz jej interfejs Aspose.Slides.SmartArt.ISmartArtShapeCollection) zapewnia dostęp do poszczególnych kształtów w diagramie SmartArt. Kolekcja zawiera kształty powiązane z SmartArtNode. Właściwość SmartArtNode.Shapes zwraca kolekcję wszystkich kształtów powiązanych z węzłem.


 Presentation pres = new Presentation();

ISmartArt smart = pres.getSlides().get_Item(0).getShapes().addSmartArt(10, 10, 400, 300, SmartArtLayoutType.BasicBlockList);

ISmartArtNode node = smart.getAllNodes().get_Item(0);

for (ISmartArtShape shape : node.getShapes())

{

    shape.getFillFormat().setFillType(FillType.Solid);

    shape.getFillFormat().getSolidFillColor().setColor(Color.RED);

}

pres.save("out.pptx", SaveFormat.Pptx);