ShapeCollection — Aspose.Slides FOSS for Java API Reference

BoundingBoxExtent ShapeCollection class mewakili kumpulan bentuk pada slide. Ini mengimplementasikan IShapeCollection dan Iterable<IShape>.

BoundingBoxExtent: org.aspose.slides.foss

import org.aspose.slides.foss.*;
public class ShapeCollection implements IShapeCollection, Iterable<IShape>

BoundingBoxExtent

BoundingBoxExtent

BoundingBoxExtentBoundingBoxExtentBoundingBoxExtent
get(int index)IShapeDapatkan bentuk berdasarkan indeks berbasis nol.
size()intJumlah bentuk.
indexOf(IShape shape)intIndeks dari bentuk yang diberikan, atau -1.
iterator()Iterator<IShape>Iterator untuk semua bentuk.

Tambah Bentuk

BoundingBoxExtentBoundingBoxExtentBoundingBoxExtent
addAutoShape(ShapeType, double x, double y, double w, double h)IAutoShapeTambahkan auto shape.
addAutoShape(ShapeType, double x, double y, double w, double h, boolean createFromTemplate)IAutoShapeTambahkan auto shape dengan opsi templat.
addConnector(ShapeType, double x, double y, double w, double h)IConnectorTambahkan bentuk penghubung.
addPictureFrame(ShapeType, double x, double y, double w, double h, IPPImage image)IPictureFrameTambahkan bingkai gambar.
addTable(double x, double y, double[] colWidths, double[] rowHeights)ITableTambahkan tabel.

Sisipkan Bentuk

BoundingBoxExtentBoundingBoxExtentBoundingBoxExtent
insertAutoShape(int index, ShapeType, double x, double y, double w, double h)IAutoShapeSisipkan auto shape pada indeks yang diberikan.
insertConnector(int index, ShapeType, double x, double y, double w, double h)IConnectorSisipkan penghubung pada indeks yang diberikan.
insertPictureFrame(int index, ShapeType, double x, double y, double w, double h, IPPImage image)IPictureFrameSisipkan bingkai gambar pada indeks yang diberikan.
insertTable(int index, double x, double y, double[] colWidths, double[] rowHeights)ITableSisipkan tabel pada indeks yang diberikan.

BoundingBoxExtent

BoundingBoxExtentBoundingBoxExtentBoundingBoxExtent
reorderSingle(int newIndex, IShape shape)voidPindahkan bentuk ke posisi z-order baru.

Contoh Penggunaan

Tambah Bentuk ke Slide

import org.aspose.slides.foss.*;

Presentation prs = new Presentation();
ISlide slide = prs.getSlides().get(0);
IShapeCollection shapes = slide.getShapes();

IAutoShape rect = shapes.addAutoShape(ShapeType.RECTANGLE, 50, 50, 200, 100);
rect.addTextFrame("Rectangle");

IAutoShape ellipse = shapes.addAutoShape(ShapeType.ELLIPSE, 300, 50, 100, 100);

System.out.println("Shape count: " + shapes.size());
prs.save("shapes.pptx", SaveFormat.PPTX);

Tambah Tabel

double[] colWidths = {100, 100, 100};
double[] rowHeights = {30, 30, 30};
ITable table = slide.getShapes().addTable(50, 200, colWidths, rowHeights);

Lihat Juga

 Bahasa Indonesia