Public API และการเปลี่ยนแปลงที่ไม่เข้ากันย้อนหลังใน Aspose.Slides for Java 14.9.0
Public API Changes
Added Methods for Replacing Image to PPImage, IPPImage
เมธอดใหม่ที่เพิ่มขึ้น:
- IPPImage.replaceImage(byte[] newImageData)
- IPPImage.replaceImage(IPPImage newImage)
Presentation presentation = new Presentation("presentation.pptx");
//วิธีที่หนึ่ง
byte[] imageData = // ...
presentation.getImages().get_Item(0).replaceImage(imageData);
//วิธีที่สอง
presentation.getImages().get_Item(1).replaceImage(
presentation.getImages().get_Item(0));
presentation.save("presentation_out.pptx", SaveFormat.Pptx);
Added Methods for Saving Slides Keeping Page Numbers
เมธอดต่อไปนี้ได้ถูกเพิ่ม:
- 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);
เมธอดเหล่านี้อนุญาตให้บันทึกสไลด์ของการนำเสนอที่ระบุเป็นรูปแบบ PDF, XPS, TIFF, HTML. อาร์เรย์ ‘slides’ ใช้ระบุเลขหน้าโดยเริ่มจาก 1.
save(string fname, int\[\] slides, SaveFormat format);
Presentation presentation = new Presentation(presentationFileName);
int[] slides = new int[] { 2, 3, 5 }; //อาร์เรย์ของตำแหน่งสไลด์
presentation.save(outFileName, slides, SaveFormat.Pdf);
Added the SmartArtLayoutType.Custom Enum Value
ประเภทของ SmartArt layout นี้แสดงแผนภูมิที่ใช้เทมเพลตกำหนดเอง. แผนภูมิที่กำหนดเองสามารถโหลดได้จากไฟล์การนำเสนอเท่านั้นและไม่สามารถสร้างได้โดยใช้เมธอด ShapeCollection.addSmartArt(x, y, width, height, SmartArtLayoutType.Custom)
Added the SmartArtShape Class and ISmartArtShape Interface
คลาส Aspose.Slides.SmartArt.SmartArtShape (และอินเทอร์เฟซ Aspose.Slides.SmartArt.ISmartArtShape) ให้การเข้าถึงรูปร่างแต่ละอันภายในแผนภูมิ SmartArt. SmartArtShape สามารถใช้เพื่อเปลี่ยน FillFormat, LineFormat, เพิ่ม Hyperlinks ฯลฯ
ตัวอย่างการใช้งาน:
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);
SmartArtShapeCollection class, ISmartArtShapeCollection interface and ISmartArtNode.getShapes() method have been added
คลาส Aspose.Slides.SmartArt.SmartArtShapeCollection (และอินเทอร์เฟซ Aspose.Slides.SmartArt.ISmartArtShapeCollection) ให้การเข้าถึงรูปร่างแต่ละอันภายในแผนภูมิ SmartArt. คอลเลกชันนี้มีรูปร่างที่เชื่อมโยงกับ SmartArtNode. คุณสมบัติ SmartArtNode.Shapes จะคืนคอลเลกชันของรูปร่างทั้งหมดที่เชื่อมโยงกับโหนด
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);