public final class ShapeCollection extends DomObject<GroupShape> implements IShapeCollection
Represents a collection of shapes.
| Modifier and Type | Method and Description |
|---|---|
IAudioFrame |
addAudioFrameCD(float x,
float y,
float width,
float height)
Creates a new audio frame linked to a CD track and adds it to the end of the shape collection.
|
IAudioFrame |
addAudioFrameEmbedded(float x,
float y,
float width,
float height,
IAudio audio)
Creates a new audio frame and adds it to the end of the shape collection using an
existing audio object from the Presentation.Audios list.
|
IAudioFrame |
addAudioFrameEmbedded(float x,
float y,
float width,
float height,
java.io.InputStream audio_stream)
Creates a new audio frame with an embedded WAV file and adds it to the end of the
shape collection.
|
IAudioFrame |
addAudioFrameLinked(float x,
float y,
float width,
float height,
java.lang.String fname)
Creates a new audio frame linked to an external audio file and adds it to the end of
the shape collection.
|
IAutoShape |
addAutoShape(int shapeType,
float x,
float y,
float width,
float height)
Creates a new auto shape with default formatting and adds it to the end of the
shape collection.
|
IAutoShape |
addAutoShape(int shapeType,
float x,
float y,
float width,
float height,
boolean createFromTemplate)
Creates a new auto shape and adds it to the end of the shape collection, optionally
initializing it with default template formatting.
|
IChart |
addChart(int type,
float x,
float y,
float width,
float height)
Creates a new chart, initializes it with sample series data and settings, and adds
it to the end of the shape collection.
|
IChart |
addChart(int type,
float x,
float y,
float width,
float height,
boolean initWithSample)
Creates a new chart, initializes it with sample series data and settings, and adds
it to the end of the shape collection.
|
IShape |
addClone(IShape sourceShape)
Creates a copy of the specified shape and adds it to the end of the shape collection.
|
IShape |
addClone(IShape sourceShape,
float x,
float y)
Creates a copy of the specified shape and adds it to the end of the shape collection.
|
IShape |
addClone(IShape sourceShape,
float x,
float y,
float width,
float height)
Creates a copy of the specified shape and adds it to the end of the shape collection.
|
IConnector |
addConnector(int shapeType,
float x,
float y,
float width,
float height)
Creates a new connector shape with default template styling and adds it to the end of the
shape collection.
|
IConnector |
addConnector(int shapeType,
float x,
float y,
float width,
float height,
boolean createFromTemplate)
Creates a new connector shape and adds it to the end of the shape collection,
optionally applying default template styling.
|
IGroupShape |
addGroupShape()
Creates a new empty group shape and adds it to the end of the shape collection.
|
IGroupShape |
addGroupShape(ISvgImage svgImage,
float x,
float y,
float width,
float height)
Creates a new group shape, converts the specified SVG image into individual shapes,
and adds the resulting group to the end of the shape collection.
|
IAutoShape |
addMathShape(float x,
float y,
float width,
float height)
Creates a new rectangle auto shape to host mathematical content and adds it to the
end of the shape collection.
|
IOleObjectFrame |
addOleObjectFrame(float x,
float y,
float width,
float height,
IOleEmbeddedDataInfo dataInfo)
Creates a new OLE object frame and adds it to the end of the shape collection.
|
IOleObjectFrame |
addOleObjectFrame(float x,
float y,
float width,
float height,
java.lang.String className,
java.lang.String path)
Creates a new OLE object frame and adds it to the end of the shape collection.
|
IPictureFrame |
addPictureFrame(int shapeType,
float x,
float y,
float width,
float height,
IPPImage image)
Creates a new picture frame containing the specified image and adds it to the end of the
shape collection.
|
ISectionZoomFrame |
addSectionZoomFrame(float x,
float y,
float width,
float height,
ISection section)
Creates a new Section Zoom frame and adds it to the end of the shape collection.
|
ISectionZoomFrame |
addSectionZoomFrame(float x,
float y,
float width,
float height,
ISection section,
IPPImage image)
Creates a new Section Zoom frame with a predefined image and adds it to the end of the shape collection.
|
ISmartArt |
addSmartArt(float x,
float y,
float width,
float height,
int layoutType)
Creates a SmartArt diagram and adds it to the end of the shape collection.
|
ISummaryZoomFrame |
addSummaryZoomFrame(float x,
float y,
float width,
float height)
Creates a new Summary Zoom frame and adds it to the end of the shape collection.
|
ITable |
addTable(float x,
float y,
double[] columnWidths,
double[] rowHeights)
Creates a new table and adds it to the end of the shape collection.
|
IVideoFrame |
addVideoFrame(float x,
float y,
float width,
float height,
IVideo video)
Creates a new video frame and adds it to the end of the shape collection.
|
IVideoFrame |
addVideoFrame(float x,
float y,
float width,
float height,
java.lang.String fname)
Creates a new video frame and adds it to the end of the shape collection.
|
IZoomFrame |
addZoomFrame(float x,
float y,
float width,
float height,
ISlide slide)
Creates a new Zoom frame and adds it to the end of the shape collection.
|
IZoomFrame |
addZoomFrame(float x,
float y,
float width,
float height,
ISlide slide,
IPPImage image)
Creates a new Zoom frame and adds it to the end of the shape collection.
|
void |
clear()
Removes all shapes from the shape collection.
|
void |
copyTo(com.aspose.ms.System.Array array,
int index)
Copies all elements from the collection to the specified array.
|
IShape |
get_Item(int index)
Gets the element at the specified index.
|
IGroupShape |
getParentGroup()
Gets the parent group shape object for the shapes collection.
|
java.lang.Object |
getSyncRoot()
Returns a synchronization root.
|
int |
indexOf(IShape shape)
Returns the zero-based index of the first occurrence of the specified shape in the collection.
|
IAudioFrame |
insertAudioFrameCD(int index,
float x,
float y,
float width,
float height)
Creates a new audio frame linked to a CD track and inserts it into the shape collection
at the specified index.
|
IAudioFrame |
insertAudioFrameEmbedded(int index,
float x,
float y,
float width,
float height,
IAudio audio)
Creates a new audio frame and inserts it into the shape collection at the specified index
using an existing audio object from the Presentation.Audios list.
|
IAudioFrame |
insertAudioFrameEmbedded(int index,
float x,
float y,
float width,
float height,
java.io.InputStream audio_stream)
Creates a new audio frame with an embedded WAV file and inserts it into the shape
collection at the specified index.
|
IAudioFrame |
insertAudioFrameLinked(int index,
float x,
float y,
float width,
float height,
java.lang.String fname)
Creates a new audio frame linked to an external audio file and inserts it into the shape
collection at the specified index.
|
IAutoShape |
insertAutoShape(int index,
int shapeType,
float x,
float y,
float width,
float height)
Creates a new auto shape and inserts it into the shape collection at the specified index,
applying default template formatting.
|
IAutoShape |
insertAutoShape(int index,
int shapeType,
float x,
float y,
float width,
float height,
boolean createFromTemplate)
Creates a new auto shape and inserts it into the shape collection at the specified index,
optionally initializing it with default template styling.
|
IChart |
insertChart(int type,
float x,
float y,
float width,
float height,
int index)
Creates a new chart, initializes it with sample series data and settings,
and inserts it into the shape collection at the specified index.
|
IChart |
insertChart(int type,
float x,
float y,
float width,
float height,
int index,
boolean initWithSample)
Creates a new chart, initializes it with sample series data and settings,
and inserts it into the shape collection at the specified index.
|
IShape |
insertClone(int index,
IShape sourceShape)
Creates a copy of the specified shape and inserts it into the shape collection at the specified index.
|
IShape |
insertClone(int index,
IShape sourceShape,
float x,
float y)
Creates a copy of the specified shape and inserts it into the shape collection at the specified index.
|
IShape |
insertClone(int index,
IShape sourceShape,
float x,
float y,
float width,
float height)
Creates a copy of the specified shape and inserts it into the shape collection at the specified index.
|
IConnector |
insertConnector(int index,
int shapeType,
float x,
float y,
float width,
float height)
Creates a new connector shape and inserts it into the shape collection at the specified index,
applying default template styling.
|
IConnector |
insertConnector(int index,
int shapeType,
float x,
float y,
float width,
float height,
boolean createFromTemplate)
Creates a new connector shape and inserts it into the shape collection at the specified index,
optionally applying default template styling.
|
IGroupShape |
insertGroupShape(int index)
Creates a new empty group shape and inserts it to the shape collection at the specified index.
|
IOleObjectFrame |
insertOleObjectFrame(int index,
float x,
float y,
float width,
float height,
IOleEmbeddedDataInfo dataInfo)
Creates a new OLE object frame and inserts it into the shape collection at the specified index.
|
IOleObjectFrame |
insertOleObjectFrame(int index,
float x,
float y,
float width,
float height,
java.lang.String className,
java.lang.String path)
Creates a new OLE object frame and inserts it into the shape collection at the specified index.
|
IPictureFrame |
insertPictureFrame(int index,
int shapeType,
float x,
float y,
float width,
float height,
IPPImage image)
Creates a new picture frame containing the specified image and inserts it into the shape
collection at the specified index.
|
ISectionZoomFrame |
insertSectionZoomFrame(int index,
float x,
float y,
float width,
float height,
ISection section)
Creates a new Section Zoom frame and inserts it into to the shape collection at the specified index.
|
ISectionZoomFrame |
insertSectionZoomFrame(int index,
float x,
float y,
float width,
float height,
ISection section,
IPPImage image)
Creates a new Section Zoom frame with a predefined image and inserts it into to the shape
collection at the specified index.
|
ISummaryZoomFrame |
insertSummaryZoomFrame(int index,
float x,
float y,
float width,
float height)
Creates a new Summary Zoom frame and inserts it into the shape collection at the specified index.
|
ITable |
insertTable(int index,
float x,
float y,
double[] columnWidths,
double[] rowHeights)
Creates a new table and inserts it into the shape collection at the specified index.
|
IVideoFrame |
insertVideoFrame(int index,
float x,
float y,
float width,
float height,
java.lang.String fname)
Creates a new video frame and inserts it into the shape collection at the specified index.
|
IZoomFrame |
insertZoomFrame(int index,
float x,
float y,
float width,
float height,
ISlide slide)
Creates a new Zoom frame and inserts it into the shape collection at the specified index.
|
IZoomFrame |
insertZoomFrame(int index,
float x,
float y,
float width,
float height,
ISlide slide,
IPPImage image)
Creates a new Zoom frame with a predefined image and inserts it into the shape collection
at the specified index.
|
boolean |
isSynchronized()
Returns a value indicating whether access to the collection is synchronized (thread-safe).
|
com.aspose.ms.System.Collections.Generic.IGenericEnumerator<IShape> |
iterator()
Returns an enumerator that iterates through the collection.
|
com.aspose.ms.System.Collections.Generic.IGenericEnumerator<IShape> |
iteratorJava()
Returns a java iterator for the entire collection.
|
void |
remove(IShape shape)
Removes the first occurrence of the specified shape from the shape collection.
|
void |
removeAt(int index)
Removes the shape at the specified index from the shape collection.
|
void |
reorder(int index,
IShape... shapes)
Moves the specified shapes within the shape collection, placing them starting at the given index.
|
void |
reorder(int index,
IShape shape)
Moves the specified shape to a new position within the shape collection.
|
int |
size()
Gets the number of elements actually contained in the collection.
|
IShape[] |
toArray()
Creates and returns an array that contains all shapes.
|
IShape[] |
toArray(int startIndex,
int count)
Creates and returns an array that contains all shapes in the specified range.
|
getParent_Immediatepublic final int size()
Gets the number of elements actually contained in the collection.
Read-only int.
size in interface com.aspose.ms.System.Collections.ICollection<IShape>public final IShape get_Item(int index)
Gets the element at the specified index.
Read-only IShape.
get_Item in interface IShapeCollectionpublic final IChart addChart(int type, float x, float y, float width, float height)
Creates a new chart, initializes it with sample series data and settings, and adds it to the end of the shape collection.
The following example shows how to create Chart in PowerPoint Presentation.// Instantiates the Presentation class that represents a PPTX file Presentation pres = new Presentation(); try { // Accesses the first slide ISlide sld = pres.getSlides().get_Item(0); // Adds a chart with its default data IChart chart = sld.getShapes().addChart(ChartType.ClusteredColumn, 0, 0, 500, 500); // Sets the chart title chart.getChartTitle().addTextFrameForOverriding("Sample Title"); chart.getChartTitle().getTextFrameForOverriding().getTextFrameFormat().setCenterText(NullableBool.True); chart.getChartTitle().setHeight(20); chart.setTitle(true); // Sets the first series to show values chart.getChartData().getSeries().get_Item(0).getLabels().getDefaultDataLabelFormat().setShowValue(true); // Sets the index for the chart data sheet int defaultWorksheetIndex = 0; // Gets the chart data worksheet IChartDataWorkbook fact = chart.getChartData().getChartDataWorkbook(); // Deletes the default generated series and categories chart.getChartData().getSeries().clear(); chart.getChartData().getCategories().clear(); // Adds new series chart.getChartData().getSeries().add(fact.getCell(defaultWorksheetIndex, 0, 1, "Series 1"), chart.getType()); chart.getChartData().getSeries().add(fact.getCell(defaultWorksheetIndex, 0, 2, "Series 2"), chart.getType()); // Adds new categories chart.getChartData().getCategories().add(fact.getCell(defaultWorksheetIndex, 1, 0, "Caetegoty 1")); chart.getChartData().getCategories().add(fact.getCell(defaultWorksheetIndex, 2, 0, "Caetegoty 2")); chart.getChartData().getCategories().add(fact.getCell(defaultWorksheetIndex, 3, 0, "Caetegoty 3")); // Takes the first chart series IChartSeries series = chart.getChartData().getSeries().get_Item(0); // Populates series data series.getDataPoints().addDataPointForBarSeries(fact.getCell(defaultWorksheetIndex, 1, 1, 20)); series.getDataPoints().addDataPointForBarSeries(fact.getCell(defaultWorksheetIndex, 2, 1, 50)); series.getDataPoints().addDataPointForBarSeries(fact.getCell(defaultWorksheetIndex, 3, 1, 30)); // Sets the fill color for the series series.getFormat().getFill().setFillType(FillType.Solid); series.getFormat().getFill().getSolidFillColor().setColor(Color.RED); // Takes the second chart series series = chart.getChartData().getSeries().get_Item(1); // Populates series data series.getDataPoints().addDataPointForBarSeries(fact.getCell(defaultWorksheetIndex, 1, 2, 30)); series.getDataPoints().addDataPointForBarSeries(fact.getCell(defaultWorksheetIndex, 2, 2, 10)); series.getDataPoints().addDataPointForBarSeries(fact.getCell(defaultWorksheetIndex, 3, 2, 60)); // Sets the fill color for series series.getFormat().getFill().setFillType(FillType.Solid); series.getFormat().getFill().getSolidFillColor().setColor(Color.GREEN); // Sets the first label to show Category name IDataLabel lbl = series.getDataPoints().get_Item(0).getLabel(); lbl.getDataLabelFormat().setShowCategoryName(true); lbl = series.getDataPoints().get_Item(1).getLabel(); lbl.getDataLabelFormat().setShowSeriesName(true); // Sets the series to show the value for the third label lbl = series.getDataPoints().get_Item(2).getLabel(); lbl.getDataLabelFormat().setShowValue(true); lbl.getDataLabelFormat().setShowSeriesName(true); lbl.getDataLabelFormat().setSeparator("/"); // Saves the PPTX file to disk pres.save("AsposeChart_out.pptx", SaveFormat.Pptx); } finally { if (pres != null) pres.dispose(); }
addChart in interface IShapeCollectiontype - The type of chart to add.x - The x-coordinate of the new chart, in points.y - The y-coordinate of the new chart, in points.width - The width of the chart, in points.height - The height of the chart, in points.IChart.public final IChart addChart(int type, float x, float y, float width, float height, boolean initWithSample)
Creates a new chart, initializes it with sample series data and settings, and adds it to the end of the shape collection.
addChart in interface IShapeCollectiontype - The type of chart to add.x - The x-coordinate of the new chart, in points.y - The y-coordinate of the new chart, in points.width - The width of the chart, in points.height - The height of the chart, in points.initWithSample - True to initialize the new chart with sample series data and settings;
false to create the chart with no series and only minimal settings, which makes creation
faster.IChart.public final ISmartArt addSmartArt(float x, float y, float width, float height, int layoutType)
Creates a SmartArt diagram and adds it to the end of the shape collection.
The following example shows how to add smart shape in PowerPoint Presentation.Presentation pres = new Presentation(); try { ISlide slide = pres.getSlides().get_Item(0); ISmartArt smart = slide.getShapes().addSmartArt(0, 0, 400, 400, SmartArtLayoutType.BasicBlockList); } finally { if (pres != null) pres.dispose(); }
addSmartArt in interface IShapeCollectionx - The x-coordinate of the diagram's frame, in points.y - The y-coordinate of the diagram's frame, in points.width - The width of the diagram's frame, in points.height - The height of the diagram's frame, in points.layoutType - The SmartArt layout type.ISmartArt.public final IChart insertChart(int type, float x, float y, float width, float height, int index)
Creates a new chart, initializes it with sample series data and settings, and inserts it into the shape collection at the specified index.
insertChart in interface IShapeCollectiontype - The type of chart to create.x - The x-coordinate of the new chart, in points.y - The y-coordinate of the new chart, in points.width - The width of the new chart, in points.height - The height of the new chart, in points.index - The zero-based index at which to insert the new chart in the shape collection.IChart.public final IChart insertChart(int type, float x, float y, float width, float height, int index, boolean initWithSample)
Creates a new chart, initializes it with sample series data and settings, and inserts it into the shape collection at the specified index.
insertChart in interface IShapeCollectiontype - The type of chart to create.x - The x-coordinate of the new chart, in points.y - The y-coordinate of the new chart, in points.width - The width of the new chart, in points.height - The height of the new chart, in points.index - The zero-based index at which to insert the new chart in the shape collection.initWithSample - True to initialize the new chart with sample series data and settings;
false to create the chart with no series and only minimal settings, which makes creation faster.IChart.public final IZoomFrame addZoomFrame(float x, float y, float width, float height, ISlide slide)
Creates a new Zoom frame and adds it to the end of the shape collection.
This example demonstrates adding a Zoom object to the end of a collection (assume that there are at least two slides in the "Presentation.pptx" presentation):Presentation pres = new Presentation("Presentation.pptx"); try { IZoomFrame zoomFrame = pres.getSlides().get_Item(0).getShapes().addZoomFrame(150, 20, 50, 50, pres.getSlides().get_Item(1)); } finally { if (pres != null) pres.dispose(); }
addZoomFrame in interface IShapeCollectionx - The x-coordinate of the new Zoom frame, in points.y - The y-coordinate of the new Zoom frame, in points.width - The width of the new Zoom frame, in points.height - The height of the new Zoom frame, in points.slide - The ISlide referenced by the Zoom frame;
must belong to this presentation.IZoomFrame.com.aspose.ms.System.ArgumentException - Thrown if the referenced slide does not belong to the current presentation.public final IZoomFrame addZoomFrame(float x, float y, float width, float height, ISlide slide, IPPImage image)
Creates a new Zoom frame and adds it to the end of the shape collection.
This example demonstrates adding a Zoom object to the end of a collection (assume that there are at least two slides in the "Presentation.pptx" presentation):Presentation pres = new Presentation("Presentation.pptx"); try { IPPImage image = pres.getImages().addImage(imageBytes); IZoomFrame zoomFrame = pres.getSlides().get_Item(0).getShapes().addZoomFrame(150, 20, 50, 50, pres.getSlides().get_Item(1), image); } finally { if (pres != null) pres.dispose(); }
addZoomFrame in interface IShapeCollectionx - The x-coordinate of the new Zoom frame, in points.y - The y-coordinate of the new Zoom frame, in points.width - The width of the new Zoom frame, in points.height - The height of the new Zoom frame, in points.slide - The ISlide referenced by the Zoom frame;
must belong to this presentation.image - The image for the referenced slide IPPImage.IZoomFrame.com.aspose.ms.System.ArgumentException - Thrown if the referenced slide does not belong to the current presentation.public final IZoomFrame insertZoomFrame(int index, float x, float y, float width, float height, ISlide slide)
Creates a new Zoom frame and inserts it into the shape collection at the specified index.
This example demonstrates creation and inserting a Zoom object at the specified index of a collection (assume that there are at least two slides in the "Presentation.pptx" presentation):Presentation pres = new Presentation("Presentation.pptx"); try { IZoomFrame zoomFrame = pres.getSlides().get_Item(0).getShapes().insertZoomFrame(2, 150, 20, 50, 50, pres.getSlides().get_Item(1)); } finally { if (pres != null) pres.dispose(); }
insertZoomFrame in interface IShapeCollectionindex - The zero-based index at which to insert the Zoom frame.x - The x-coordinate of the new Zoom frame, in points.y - The y-coordinate of the new Zoom frame, in points.width - The width of the new Zoom frame, in points.height - The height of the new Zoom frame, in points.slide - The ISlide referenced by the Zoom frame.IZoomFrame.com.aspose.ms.System.ArgumentException - Thrown if the referenced slide does not belong to the current presentation.public final IZoomFrame insertZoomFrame(int index, float x, float y, float width, float height, ISlide slide, IPPImage image)
Creates a new Zoom frame with a predefined image and inserts it into the shape collection at the specified index.
This example demonstrates creation and inserting a Zoom object at the specified index of a collection (assume that there are at least two slides in the "Presentation.pptx" presentation):Presentation pres = new Presentation("Presentation.pptx"); try { IPPImage image = pres.getImages().addImage(imageBytes); IZoomFrame zoomFrame = pres.getSlides().get_Item(0).getShapes().insertZoomFrame(2, 150, 20, 50, 50, pres.getSlides().get_Item(1), image); } finally { if (pres != null) pres.dispose(); }
insertZoomFrame in interface IShapeCollectionindex - The zero-based index at which to insert the Zoom frame.x - The x-coordinate of the new Zoom frame, in points.y - The y-coordinate of the new Zoom frame, in points.width - The width of the new Zoom frame, in points.height - The height of the new Zoom frame, in points.slide - The ISlide referenced by the Zoom frame.image - The image for the referenced slide IPPImage.IZoomFrame.com.aspose.ms.System.ArgumentException - Thrown if the referenced slide does not belong to the current presentation.public final ISectionZoomFrame addSectionZoomFrame(float x, float y, float width, float height, ISection section)
Creates a new Section Zoom frame and adds it to the end of the shape collection.
This example demonstrates adding a Section Zoom object to the end of a collection (assume that there are at least two sections in the "Presentation.pptx" presentation):Presentation pres = new Presentation("Presentation.pptx"); try { ISectionZoomFrame zoomFrame = pres.getSlides().get_Item(0).getShapes().addSectionZoomFrame(150, 20, 50, 50, pres.getSections().get_Item(1)); } finally { if (pres != null) pres.dispose(); }
addSectionZoomFrame in interface IShapeCollectionx - The x-coordinate of the new Section Zoom frame, in points.y - The y-coordinate of the new Section Zoom frame, in points.width - The width of the new Section Zoom frame, in points.height - The height of the new Section Zoom frame, in points.section - The ISection referenced by the Section Zoom frame;
must belong to this presentation and contain at least one slide.ISectionZoomFrame.com.aspose.ms.System.ArgumentException - Thrown if the referenced section does not belong to the current presentation or contains no slides.public final ISectionZoomFrame addSectionZoomFrame(float x, float y, float width, float height, ISection section, IPPImage image)
Creates a new Section Zoom frame with a predefined image and adds it to the end of the shape collection.
This example demonstrates adding a Section Zoom object to the end of a collection (assume that there are at least two sections in the "Presentation.pptx" presentation):Presentation pres = new Presentation("Presentation.pptx"); try { IPPImage image = pres.getImages().addImage(Files.readAllBytes(Paths.get("image.png"))); ISectionZoomFrame zoomFrame = pres.getSlides().get_Item(0).getShapes().addSectionZoomFrame(150, 20, 50, 50, pres.getSections().get_Item(1), image); } catch (IOException e) { } finally { if (pres != null) pres.dispose(); }
addSectionZoomFrame in interface IShapeCollectionx - The x-coordinate of the new Section Zoom frame, in points.y - The y-coordinate of the new Section Zoom frame, in points.width - The width of the new Section Zoom frame, in points.height - The height of the new Section Zoom frame, in points.section - The ISection referenced by the Section Zoom frame;
must belong to this presentation and contain at least one slide.image - The IPPImage to display within the Section Zoom frame.ISectionZoomFrame.com.aspose.ms.System.ArgumentException - Thrown if the referenced section does not belong to the current presentation or contains no slides.public final ISectionZoomFrame insertSectionZoomFrame(int index, float x, float y, float width, float height, ISection section)
Creates a new Section Zoom frame and inserts it into to the shape collection at the specified index.
This example demonstrates the creation and inserting a Section Zoom object at the specified index of a collection (assume that there are at least two sections in the "Presentation.pptx" presentation):Presentation pres = new Presentation("Presentation.pptx"); try { ISectionZoomFrame zoomFrame = pres.getSlides().get_Item(0).getShapes().insertSectionZoomFrame(2, 150, 20, 50, 50, pres.getSections().get_Item(1)); } finally { if (pres != null) pres.dispose(); }
insertSectionZoomFrame in interface IShapeCollectionindex - The zero-based index at which to insert the Section Zoom frame.x - The x-coordinate of the new Section Zoom frame, in points.y - The y-coordinate of the new Section Zoom frame, in points.width - The width of the new Section Zoom frame, in points.height - The height of the new Section Zoom frame, in points.section - The ISection referenced by the Section Zoom frame;
must belong to this presentation and contain at least one slide.ISectionZoomFrame.com.aspose.ms.System.ArgumentException - Thrown if the referenced section does not belong to the current presentation or contains no slides.public final ISectionZoomFrame insertSectionZoomFrame(int index, float x, float y, float width, float height, ISection section, IPPImage image)
Creates a new Section Zoom frame with a predefined image and inserts it into to the shape collection at the specified index.
This example demonstrates the creation and inserting a Section Zoom object at the specified index of a collection (assume that there are at least two sections in the "Presentation.pptx" presentation):Presentation pres = new Presentation("Presentation.pptx"); try { IPPImage image = pres.getImages().addImage(Files.readAllBytes(Paths.get("image.png"))); ISectionZoomFrame zoomFrame = pres.getSlides().get_Item(0).getShapes().insertSectionZoomFrame(2, 150, 20, 50, 50, pres.getSections().get_Item(1), image); } catch (IOException e) { } finally { if (pres != null) pres.dispose(); }
insertSectionZoomFrame in interface IShapeCollectionindex - The zero-based index at which to insert the Section Zoom frame.x - The x-coordinate of the new Section Zoom frame, in points.y - The y-coordinate of the new Section Zoom frame, in points.width - The width of the new Section Zoom frame, in points.height - The height of the new Section Zoom frame, in points.section - The ISection referenced by the Section Zoom frame;
must belong to this presentation and contain at least one slide.image - The image to display within the Section Zoom frame.ISectionZoomFrame.com.aspose.ms.System.ArgumentException - Thrown if the referenced section does not belong to the current presentation or contains no slides.public final ISummaryZoomFrame addSummaryZoomFrame(float x, float y, float width, float height)
Creates a new Summary Zoom frame and adds it to the end of the shape collection.
This example demonstrates adding a Summary Zoom object to the end of a collection (assume that there are at least two sections in the "Presentation.pptx" presentation):Presentation pres = new Presentation("Presentation.pptx"); try { ISummaryZoomFrame zoomFrame = pres.getSlides().get_Item(0).getShapes().addSummaryZoomFrame(150, 20, 500, 250); } finally { if (pres != null) pres.dispose(); }
addSummaryZoomFrame in interface IShapeCollectionx - The x-coordinate of the new Summary Zoom frame, in points.y - The y-coordinate of the new Summary Zoom frame, in points.width - The width of the new Summary Zoom frame, in points.height - The height of the new Summary Zoom frame, in points.
ISummaryZoomFrame.PptxEditException - Thrown if there are no sections in the presentation, or if the target slide does not belong to any section.public final ISummaryZoomFrame insertSummaryZoomFrame(int index, float x, float y, float width, float height)
Creates a new Summary Zoom frame and inserts it into the shape collection at the specified index.
This example demonstrates creation and inserting a Summary Zoom object at the specified index of a collection (assume that there are at least two sections in the "Presentation.pptx" presentation):Presentation pres = new Presentation("Presentation.pptx"); try { ISummaryZoomFrame zoomFrame = pres.getSlides().get_Item(0).getShapes().insertSummaryZoomFrame(2, 150, 20, 50, 50); } finally { if (pres != null) pres.dispose(); }
insertSummaryZoomFrame in interface IShapeCollectionindex - The zero-based index at which to insert the Summary Zoom frame.x - The x-coordinate of the new Summary Zoom frame, in points.y - The y-coordinate of the new Summary Zoom frame, in points.width - The width of the new Summary Zoom frame, in points.height - The height of the new Summary Zoom frame, in points.
ISummaryZoomFrame.PptxEditException - Thrown if the presentation contains no sections, or if the target slide does not belong to any section.public final IOleObjectFrame addOleObjectFrame(float x, float y, float width, float height, IOleEmbeddedDataInfo dataInfo)
Creates a new OLE object frame and adds it to the end of the shape collection.
The following examples shows how to adding OLE Object Frames to Slides of PowerPoint Presentation.// Instantiate Presentation class that represents the PPTX Presentation pres = new Presentation(); try { // Access the first slide ISlide sld = pres.getSlides().get_Item(0); // Load an cel file to stream FileInputStream fs = new FileInputStream("book1.xlsx"); ByteArrayOutputStream mstream = new ByteArrayOutputStream(); byte[] buf = new byte[4096]; while (true) { int bytesRead = fs.read(buf, 0, buf.length); if (bytesRead <= 0) break; mstream.write(buf, 0, bytesRead); } // Create data object for embedding IOleEmbeddedDataInfo dataInfo = new OleEmbeddedDataInfo(mstream.toByteArray(), "xlsx"); // Add an Ole Object Frame shape IOleObjectFrame oleObjectFrame = sld.getShapes().addOleObjectFrame(0, 0, (float)pres.getSlideSize().getSize().getWidth(), (float)pres.getSlideSize().getSize().getHeight(), dataInfo); //Write the PPTX to disk pres.save("OleEmbed_out.pptx", SaveFormat.Pptx); } catch (IOException e) { } finally { if (pres != null) pres.dispose(); }
addOleObjectFrame in interface IShapeCollectionx - The x-coordinate of the new OLE frame, in points.y - The y-coordinate of the new OLE frame, in points.width - The width of the new OLE frame, in points.height - The height of the new OLE frame, in points.dataInfo - The information about the embedded OLE data (IOleEmbeddedDataInfo).IOleObjectFrame.public final IOleObjectFrame addOleObjectFrame(float x, float y, float width, float height, java.lang.String className, java.lang.String path)
Creates a new OLE object frame and adds it to the end of the shape collection.
addOleObjectFrame in interface IShapeCollectionx - The x-coordinate of the new OLE frame, in points.y - The y-coordinate of the new OLE frame, in points.width - The width of the new OLE frame, in points.height - The height of the new OLE frame, in points.className - The class name of the OLE object.path - The path to the linked file. This path is stored verbatim in the presentation. If a relative path is specified, the file will be inaccessible when opening the presentation from a different directory.
IOleObjectFrame.public final IOleObjectFrame insertOleObjectFrame(int index, float x, float y, float width, float height, IOleEmbeddedDataInfo dataInfo)
Creates a new OLE object frame and inserts it into the shape collection at the specified index.
This example demonstrates inserting an OLE object at the second index:byte[] fileData = Files.readAllBytes(Paths.get("test.zip")); IOleDataInfo dataInfo = new OleDataInfo(fileData, "zip"); IOleObjectFrame oleObjectFrame = slides.getShapes().addOleObjectFrame(2, 150, 20, 50, 50, dataInfo);
insertOleObjectFrame in interface IShapeCollectionindex - The zero-based index at which to insert the OLE object frame.x - The x-coordinate of the new OLE frame, in points.y - The y-coordinate of the new OLE frame, in points.width - The width of the new OLE frame, in points.height - The height of the new OLE frame, in points.dataInfo - The embedded OLE data information (IOleEmbeddedDataInfo).IOleObjectFrame.public final IOleObjectFrame insertOleObjectFrame(int index, float x, float y, float width, float height, java.lang.String className, java.lang.String path)
Creates a new OLE object frame and inserts it into the shape collection at the specified index.
insertOleObjectFrame in interface IShapeCollectionindex - The zero-based index at which to insert the OLE object frame.x - The x-coordinate of the new OLE frame, in points.y - The y-coordinate of the new OLE frame, in points.width - The width of the new OLE frame, in points.height - The height of the new OLE frame, in points.className - The class name of the OLE object.path - The path to the linked file. This path is stored verbatim in the presentation. If a relative path is specified, the file will be inaccessible when opening the presentation from a different directory.
public final IVideoFrame addVideoFrame(float x, float y, float width, float height, java.lang.String fname)
Creates a new video frame and adds it to the end of the shape collection.
addVideoFrame in interface IShapeCollectionx - The x-coordinate of the new video frame, in points.y - The y-coordinate of the new video frame, in points.width - The width of the new video frame, in points.height - The height of the new video frame, in points.fname - The path or name of the video file to embed.IVideoFrame.public final IVideoFrame addVideoFrame(float x, float y, float width, float height, IVideo video)
Creates a new video frame and adds it to the end of the shape collection.
addVideoFrame in interface IShapeCollectionx - The x-coordinate of the new video frame, in points.y - The y-coordinate of the new video frame, in points.width - The width of the new video frame, in points.height - The height of the new video frame, in points.video - The IVideo to embed in the video frame.IVideoFrame.public final IVideoFrame insertVideoFrame(int index, float x, float y, float width, float height, java.lang.String fname)
Creates a new video frame and inserts it into the shape collection at the specified index.
insertVideoFrame in interface IShapeCollectionindex - The zero-based index at which to insert the video frame.x - The x-coordinate of the new video frame, in points.y - The y-coordinate of the new video frame, in points.width - The width of the new video frame, in points.height - The height of the new video frame, in points.fname - The path or name of the video file to embed.IVideoFrame.public final IAudioFrame addAudioFrameCD(float x, float y, float width, float height)
Creates a new audio frame linked to a CD track and adds it to the end of the shape collection.
addAudioFrameCD in interface IShapeCollectionx - The x-coordinate of the new audio frame, in points.y - The y-coordinate of the new audio frame, in points.width - The width of the new audio frame, in points.height - The height of the new audio frame, in points.IAudioFrame.public final IAudioFrame insertAudioFrameCD(int index, float x, float y, float width, float height)
Creates a new audio frame linked to a CD track and inserts it into the shape collection at the specified index.
insertAudioFrameCD in interface IShapeCollectionindex - The zero-based index at which to insert the audio frame.x - The x-coordinate of the new audio frame, in points.y - The y-coordinate of the new audio frame, in points.width - The width of the new audio frame, in points.height - The height of the new audio frame, in points.IAudioFrame.public final IAudioFrame addAudioFrameLinked(float x, float y, float width, float height, java.lang.String fname)
Creates a new audio frame linked to an external audio file and adds it to the end of the shape collection.
addAudioFrameLinked in interface IShapeCollectionx - The x-coordinate of the new audio frame, in points.y - The y-coordinate of the new audio frame, in points.width - The width of the new audio frame, in points.height - The height of the new audio frame, in points.fname - The path or name of the external audio file to link.IAudioFrame.public final IAudioFrame insertAudioFrameLinked(int index, float x, float y, float width, float height, java.lang.String fname)
Creates a new audio frame linked to an external audio file and inserts it into the shape collection at the specified index.
insertAudioFrameLinked in interface IShapeCollectionindex - The zero-based index at which to insert the audio frame.x - The x-coordinate of the new audio frame, in points.y - The y-coordinate of the new audio frame, in points.width - The width of the new audio frame, in points.height - The height of the new audio frame, in points.fname - The path or name of the external audio file to link.IAudioFrame.public final IAudioFrame addAudioFrameEmbedded(float x, float y, float width, float height, java.io.InputStream audio_stream)
Creates a new audio frame with an embedded WAV file and adds it to the end of the shape collection. The embedded audio is added to the Presentation.Audios collection.
The following examples shows how to create Audio Frame.// Instantiates a presentation class that represents a presentation file Presentation pres = new Presentation(); try { // Gets the first slide ISlide sld = pres.getSlides().get_Item(0); // Loads the the wav sound file to stream FileInputStream fstr = new FileInputStream("sampleaudio.wav"); try { // Adds the Audio Frame IAudioFrame audioFrame = sld.getShapes().addAudioFrameEmbedded(50, 150, 100, 100, fstr); // Sets the Play Mode and Volume of the Audio audioFrame.setPlayMode(AudioPlayModePreset.Auto); audioFrame.setVolume(AudioVolumeMode.Loud); } finally { if (fstr != null) fstr.close(); } // Writes the PowerPoint file to disk pres.save("AudioFrameEmbed_out.pptx", SaveFormat.Pptx); } catch(IOException e) { } finally { if (pres != null) pres.dispose(); }
addAudioFrameEmbedded in interface IShapeCollectionx - The x-coordinate of the new audio frame, in points.y - The y-coordinate of the new audio frame, in points.width - The width of the new audio frame, in points.height - The height of the new audio frame, in points.audio_stream - An input stream containing WAV audio data to embed.IAudioFrame.public final IAudioFrame insertAudioFrameEmbedded(int index, float x, float y, float width, float height, java.io.InputStream audio_stream)
Creates a new audio frame with an embedded WAV file and inserts it into the shape collection at the specified index. The embedded audio is added to the Presentation.Audios collection.
insertAudioFrameEmbedded in interface IShapeCollectionindex - The zero-based index at which to insert the audio frame.x - The x-coordinate of the new audio frame, in points.y - The y-coordinate of the new audio frame, in points.width - The width of the new audio frame, in points.height - The height of the new audio frame, in points.audio_stream - An input stream containing WAV audio data to embed.IAudioFrame.public final IAudioFrame addAudioFrameEmbedded(float x, float y, float width, float height, IAudio audio)
Creates a new audio frame and adds it to the end of the shape collection using an existing audio object from the Presentation.Audios list.
addAudioFrameEmbedded in interface IShapeCollectionx - The x-coordinate of the new audio frame, in points.y - The y-coordinate of the new audio frame, in points.width - The width of the new audio frame, in points.height - The height of the new audio frame, in points.audio - An IAudio instance from the Presentation.Audios collection.IAudioFrame.public final IAudioFrame insertAudioFrameEmbedded(int index, float x, float y, float width, float height, IAudio audio)
Creates a new audio frame and inserts it into the shape collection at the specified index using an existing audio object from the Presentation.Audios list.
insertAudioFrameEmbedded in interface IShapeCollectionindex - The zero-based index at which to insert the audio frame.x - The x-coordinate of the new audio frame, in points.y - The y-coordinate of the new audio frame, in points.width - The width of the new audio frame, in points.height - The height of the new audio frame, in points.audio - An IAudio instance from the Presentation.Audios collection to embed.IAudioFrame.public final int indexOf(IShape shape)
Returns the zero-based index of the first occurrence of the specified shape in the collection.
indexOf in interface IShapeCollectionshape - The shape to locate in the collection.public final IShape[] toArray()
Creates and returns an array that contains all shapes.
toArray in interface IShapeCollectionIShape objects.public final IShape[] toArray(int startIndex, int count)
Creates and returns an array that contains all shapes in the specified range.
toArray in interface IShapeCollectionstartIndex - The index of the first shape to return.count - The number of shapes to return.IShape objects.public final void reorder(int index,
IShape shape)
Moves the specified shape to a new position within the shape collection.
reorder in interface IShapeCollectionindex - The zero-based target index where the shape will be placed.shape - The IShape to move within the collection.public final void reorder(int index,
IShape... shapes)
Moves the specified shapes within the shape collection, placing them starting at the given index.
reorder in interface IShapeCollectionindex - The zero-based target index where the first specified shape will be placed;
subsequent shapes follow in the order provided.shapes - One or more IShape instances to move within the collection.public final IAutoShape addAutoShape(int shapeType, float x, float y, float width, float height)
Creates a new auto shape with default formatting and adds it to the end of the shape collection.
addAutoShape in interface IShapeCollectionshapeType - The ShapeType of the auto shape to add.x - The x-coordinate of the shape's frame, in points.y - The y-coordinate of the shape's frame, in points.width - The width of the shape's frame, in points.height - The height of the shape's frame, in points.IAutoShape.public final IAutoShape addAutoShape(int shapeType, float x, float y, float width, float height, boolean createFromTemplate)
Creates a new auto shape and adds it to the end of the shape collection, optionally initializing it with default template formatting.
addAutoShape in interface IShapeCollectionshapeType - The ShapeType of the auto shape to add.x - The x-coordinate of the shape's frame, in points.y - The y-coordinate of the shape's frame, in points.width - The width of the shape's frame, in points.height - The height of the shape's frame, in points.createFromTemplate - True to apply default template styling (simple style, centered text, and non-empty name)
to the new shape; false to create the shape with all properties set to their default values.IAutoShape.public final IAutoShape addMathShape(float x, float y, float width, float height)
Creates a new rectangle auto shape to host mathematical content and adds it to the end of the shape collection.
The following example shows how to add Mathematical Equation in PowerPoint Presentation.Presentation pres = new Presentation(); try { IAutoShape mathShape = pres.getSlides().get_Item(0).getShapes().addMathShape(0, 0, 720, 150); IMathParagraph mathParagraph = ((MathPortion)mathShape.getTextFrame().getParagraphs().get_Item(0).getPortions().get_Item(0)).getMathParagraph(); IMathFraction fraction = new MathematicalText("x").divide("y"); mathParagraph.add(new MathBlock(fraction)); IMathBlock mathBlock = new MathematicalText("c") .setSuperscript("2") .join("=") .join(new MathematicalText("a").setSuperscript("2")) .join("+") .join(new MathematicalText("b").setSuperscript("2")); mathParagraph.add(mathBlock); pres.save("math.pptx", SaveFormat.Pptx); } finally { if (pres != null) pres.dispose(); }
addMathShape in interface IShapeCollectionx - The x-coordinate of the shape's frame, in points.y - The y-coordinate of the shape's frame, in points.width - The width of the shape's frame, in points.height - The height of the shape's frame, in points.IAutoShape.public final IAutoShape insertAutoShape(int index, int shapeType, float x, float y, float width, float height)
Creates a new auto shape and inserts it into the shape collection at the specified index, applying default template formatting.
insertAutoShape in interface IShapeCollectionindex - The zero-based index at which to insert the new auto shape.shapeType - The ShapeType of the auto shape to insert.x - The x-coordinate of the shape's frame, in points.y - The y-coordinate of the shape's frame, in points.width - The width of the shape's frame, in points.height - The height of the shape's frame, in points.IAutoShape.public final IAutoShape insertAutoShape(int index, int shapeType, float x, float y, float width, float height, boolean createFromTemplate)
Creates a new auto shape and inserts it into the shape collection at the specified index, optionally initializing it with default template styling.
insertAutoShape in interface IShapeCollectionindex - The zero-based index at which to insert the auto shape.shapeType - The ShapeType of the auto shape to insert.x - The x-coordinate of the shape's frame, in points.y - The y-coordinate of the shape's frame, in points.width - The width of the shape's frame, in points.height - The height of the shape's frame, in points.createFromTemplate - True to apply default template styling (including a non-empty name, simple style, and centered text);
false to create the shape with all properties set to their defaults.IAutoShape.public final IGroupShape addGroupShape()
Creates a new empty group shape and adds it to the end of the shape collection. The group's frame will automatically adjust to fit any shapes added to it.
The following example shows how to add a group shape to a slide of PowerPoint Presentation.// Instantiate Presentation class Presentation pres = new Presentation(); try { // Get the first slide ISlide sld = pres.getSlides().get_Item(0); // Accessing the shape collection of slides IShapeCollection slideShapes = sld.getShapes(); // Adding a group shape to the slide IGroupShape groupShape = slideShapes.addGroupShape(); // Adding shapes inside added group shape groupShape.getShapes().addAutoShape(ShapeType.Rectangle, 300, 100, 100, 100); groupShape.getShapes().addAutoShape(ShapeType.Rectangle, 500, 100, 100, 100); groupShape.getShapes().addAutoShape(ShapeType.Rectangle, 300, 300, 100, 100); groupShape.getShapes().addAutoShape(ShapeType.Rectangle, 500, 300, 100, 100); // Adding group shape frame groupShape.setFrame(new ShapeFrame(100, 300, 500, 40, NullableBool.False, NullableBool.False, 0)); // Write the PPTX file to disk pres.save("GroupShape_out.pptx", SaveFormat.Pptx); } finally { if (pres != null) pres.dispose(); }
addGroupShape in interface IShapeCollectionIGroupShape.public final IGroupShape addGroupShape(ISvgImage svgImage, float x, float y, float width, float height)
Creates a new group shape, converts the specified SVG image into individual shapes, and adds the resulting group to the end of the shape collection.
addGroupShape in interface IShapeCollectionsvgImage - The ISvgImage containing vector content to convert into shapes.x - The x-coordinate of the group's frame, in points.y - The y-coordinate of the group's frame, in points.width - The width of the group's frame, in points.height - The height of the group's frame, in points.IGroupShape.public final IGroupShape insertGroupShape(int index)
Creates a new empty group shape and inserts it to the shape collection at the specified index. The group's frame will automatically adjust to fit any shapes added to it.
insertGroupShape in interface IShapeCollectionindex - The zero-based index at which to insert the group shape.IGroupShape.public final IConnector addConnector(int shapeType, float x, float y, float width, float height)
Creates a new connector shape with default template styling and adds it to the end of the shape collection.
The following example shows how to add a connector (a bent connector) between two shapes (an ellipse and rectangle) in PowerPoint Presentation.// Instantiates a presentation class that represents a PPTX file Presentation pres = new Presentation(); try { // Accesses the shapes collection for a specific slide IShapeCollection shapes = pres.getSlides().get_Item(0).getShapes(); // Adds an Ellipse autoshape IAutoShape ellipse = shapes.addAutoShape(ShapeType.Ellipse, 0, 100, 100, 100); // Adds a Rectangle autoshape IAutoShape rectangle = shapes.addAutoShape(ShapeType.Rectangle, 100, 300, 100, 100); // Adds a connector shape to the slide shape collection IConnector connector = shapes.addConnector(ShapeType.BentConnector2, 0, 0, 10, 10); // Connects the shapes using the connector connector.setStartShapeConnectedTo(ellipse); connector.setEndShapeConnectedTo(rectangle); // Calls reroute that sets the automatic shortest path between shapes connector.reroute(); // Saves the presentation pres.save("Shapes-connector.pptx", SaveFormat.Pptx); } finally { if (pres != null) pres.dispose(); }
addConnector in interface IShapeCollectionshapeType - The ShapeType of the connector shape to add.x - The x-coordinate of the connector's frame, in points.y - The y-coordinate of the connector's frame, in points.width - The width of the connector's frame, in points.height - The height of the connector's frame, in points.IConnector.public final IConnector addConnector(int shapeType, float x, float y, float width, float height, boolean createFromTemplate)
Creates a new connector shape and adds it to the end of the shape collection, optionally applying default template styling.
addConnector in interface IShapeCollectionshapeType - The ShapeType of the connector shape to create.x - The x-coordinate of the connector's frame, in points.y - The y-coordinate of the connector's frame, in points.width - The width of the connector's frame, in points.height - The height of the connector's frame, in points.createFromTemplate - True to apply default template styling (non-empty name, simple style);
false to create the connector with default property values.IConnector.public final IConnector insertConnector(int index, int shapeType, float x, float y, float width, float height)
Creates a new connector shape and inserts it into the shape collection at the specified index, applying default template styling.
insertConnector in interface IShapeCollectionindex - The zero-based index at which to insert the connector shape.shapeType - The ShapeType of the connector shape to insert.x - The x-coordinate of the connector's frame, in points.y - The y-coordinate of the connector's frame, in points.width - The width of the connector's frame, in points.height - The height of the connector's frame, in points.IConnector.public final IConnector insertConnector(int index, int shapeType, float x, float y, float width, float height, boolean createFromTemplate)
Creates a new connector shape and inserts it into the shape collection at the specified index, optionally applying default template styling.
insertConnector in interface IShapeCollectionindex - The zero-based index at which to insert the connector shape.shapeType - The ShapeType of the connector shape to insert.x - The x-coordinate of the connector's frame, in points.y - The y-coordinate of the connector's frame, in points.width - The width of the connector's frame, in points.height - The height of the connector's frame, in points.createFromTemplate - True to apply default template styling (non-empty name, simple style);
false to create the connector with default property values.IConnector.public final IPictureFrame addPictureFrame(int shapeType, float x, float y, float width, float height, IPPImage image)
Creates a new picture frame containing the specified image and adds it to the end of the shape collection.
addPictureFrame in interface IShapeCollectionshapeType - Specifies the shape type contained in ShapeType,
except for all kinds of lines:
ShapeType.Line,
ShapeType.StraightConnector1,
ShapeType.BentConnector2,
ShapeType.BentConnector3,
ShapeType.BentConnector4,
ShapeType.BentConnector5,
ShapeType.CurvedConnector2,
ShapeType.CurvedConnector3,
ShapeType.CurvedConnector4,
ShapeType.CurvedConnector5.
x - The x-coordinate of the picture frame, in points.y - The y-coordinate of the picture frame, in points.width - The width of the picture frame, in points.height - The height of the picture frame, in points.image - The IPPImage to display in the picture frame.IPictureFrame.public final IPictureFrame insertPictureFrame(int index, int shapeType, float x, float y, float width, float height, IPPImage image)
Creates a new picture frame containing the specified image and inserts it into the shape collection at the specified index.
insertPictureFrame in interface IShapeCollectionindex - The zero-based index at which to insert the picture frame.shapeType - Specifies the shape type contained in ShapeType,
except for all kinds of lines:
ShapeType.Line,
ShapeType.StraightConnector1,
ShapeType.BentConnector2,
ShapeType.BentConnector3,
ShapeType.BentConnector4,
ShapeType.BentConnector5,
ShapeType.CurvedConnector2,
ShapeType.CurvedConnector3,
ShapeType.CurvedConnector4,
ShapeType.CurvedConnector5.
x - The x-coordinate of the picture frame, in points.y - The y-coordinate of the picture frame, in points.width - The width of the picture frame, in points.height - The height of the picture frame, in points.image - The IPPImage to display in the picture frame.IPictureFrame.public final ITable addTable(float x, float y, double[] columnWidths, double[] rowHeights)
Creates a new table and adds it to the end of the shape collection.
The following examples shows how to add table in PowerPoint Presentation.// Instantiate Presentation class that represents PPTX file Presentation pres = new Presentation(); try { // Access first slide ISlide sld = pres.getSlides().get_Item(0); // Define columns with widths and rows with heights double[] dblCols = {50, 50, 50}; double[] dblRows = {50, 30, 30, 30, 30}; // Add table shape to slide ITable tbl = sld.getShapes().addTable(100, 50, dblCols, dblRows); // Set border format for each cell for (int row = 0; row < tbl.getRows().size(); row++) { for (int cell = 0; cell < tbl.getRows().get_Item(row).size(); cell++) { tbl.get_Item(cell, row).getCellFormat().getBorderTop().getFillFormat().setFillType(FillType.Solid); tbl.get_Item(cell, row).getCellFormat().getBorderTop().getFillFormat().getSolidFillColor().setColor(Color.RED); tbl.get_Item(cell, row).getCellFormat().getBorderTop().setWidth(5); tbl.get_Item(cell, row).getCellFormat().getBorderBottom().getFillFormat().setFillType((FillType.Solid)); tbl.get_Item(cell, row).getCellFormat().getBorderBottom().getFillFormat().getSolidFillColor().setColor(Color.RED); tbl.get_Item(cell, row).getCellFormat().getBorderBottom().setWidth(5); tbl.get_Item(cell, row).getCellFormat().getBorderLeft().getFillFormat().setFillType(FillType.Solid); tbl.get_Item(cell, row).getCellFormat().getBorderLeft().getFillFormat().getSolidFillColor().setColor(Color.RED); tbl.get_Item(cell, row).getCellFormat().getBorderLeft().setWidth(5); tbl.get_Item(cell, row).getCellFormat().getBorderRight().getFillFormat().setFillType(FillType.Solid); tbl.get_Item(cell, row).getCellFormat().getBorderRight().getFillFormat().getSolidFillColor().setColor(Color.RED); tbl.get_Item(cell, row).getCellFormat().getBorderRight().setWidth(5); } } // Merge cells 1 & 2 of row 1 tbl.mergeCells(tbl.get_Item(0, 0), tbl.get_Item(1, 1), false); // Add text to the merged cell tbl.get_Item(0, 0).getTextFrame().setText("Merged Cells"); // Save PPTX to Disk pres.save("table.pptx", SaveFormat.Pptx); } finally { if (pres != null) pres.dispose(); }
addTable in interface IShapeCollectionx - The x-coordinate of the table, in points.y - The y-coordinate of the table, in points.columnWidths - An array of doubles representing the widths of the table's
columns, in points.rowHeights - An array of doubles representing the heights of the table's
rows, in points.ITable.public final ITable insertTable(int index, float x, float y, double[] columnWidths, double[] rowHeights)
Creates a new table and inserts it into the shape collection at the specified index.
insertTable in interface IShapeCollectionindex - The zero-based index at which to insert the table.x - The x-coordinate of the table, in points.y - The y-coordinate of the table, in points.columnWidths - An array of doubles representing the widths of the table's
columns, in points.rowHeights - An array of doubles representing the heights of the table's
rows, in points.ITable.public final void removeAt(int index)
Removes the shape at the specified index from the shape collection.
removeAt in interface IShapeCollectionindex - The zero-based index of the shape to remove.public final void remove(IShape shape)
Removes the first occurrence of the specified shape from the shape collection.
remove in interface IShapeCollectionshape - The IShape to remove.public final void clear()
Removes all shapes from the shape collection.
clear in interface IShapeCollectionpublic final com.aspose.ms.System.Collections.Generic.IGenericEnumerator<IShape> iterator()
Returns an enumerator that iterates through the collection.
iterator in interface com.aspose.ms.System.Collections.Generic.IGenericEnumerable<IShape>iterator in interface com.aspose.ms.System.Collections.IEnumerable<IShape>iterator in interface java.lang.Iterable<IShape>IGenericEnumerator that can be used to iterate through the collection.public final com.aspose.ms.System.Collections.Generic.IGenericEnumerator<IShape> iteratorJava()
Returns a java iterator for the entire collection.
iteratorJava in interface IGenericCollection<IShape>Iterator for the entire collection.public final IGroupShape getParentGroup()
Gets the parent group shape object for the shapes collection.
Read-only IGroupShape.
getParentGroup in interface IShapeCollectionpublic final IShape addClone(IShape sourceShape, float x, float y, float width, float height)
Creates a copy of the specified shape and adds it to the end of the shape collection.
addClone in interface IShapeCollectionsourceShape - The shape to clone.x - The x-coordinate of the new shape's frame, in points.y - The y-coordinate of the new shape's frame, in points.width - The width of the new shape's frame, in points.height - The height of the new shape's frame, in points.IShape.public final IShape addClone(IShape sourceShape, float x, float y)
Creates a copy of the specified shape and adds it to the end of the shape collection.
The new shape retains the width and height of the sourceShape.
addClone in interface IShapeCollectionsourceShape - The shape to clone.x - The x-coordinate of the new shape's frame, in points.y - The y-coordinate of the new shape's frame, in points.IShape.public final IShape addClone(IShape sourceShape)
Creates a copy of the specified shape and adds it to the end of the shape collection. The cloned shape retains the original's position and size.
addClone in interface IShapeCollectionsourceShape - The IShape to clone.IShape.public final IShape insertClone(int index, IShape sourceShape, float x, float y, float width, float height)
Creates a copy of the specified shape and inserts it into the shape collection at the specified index.
insertClone in interface IShapeCollectionindex - The zero-based index at which to insert the cloned shape.sourceShape - The IShape to clone.x - The x-coordinate of the cloned shape's frame, in points.y - The y-coordinate of the cloned shape's frame, in points.width - The width of the cloned shape's frame, in points.height - The height of the cloned shape's frame, in points.IShape.public final IShape insertClone(int index, IShape sourceShape, float x, float y)
Creates a copy of the specified shape and inserts it into the shape collection at the specified index.
The new shape retains the width and height of the sourceShape.
insertClone in interface IShapeCollectionindex - The zero-based index at which to insert the cloned shape.sourceShape - The IShape to clone.x - The x-coordinate of the cloned shape's frame, in points.y - The y-coordinate of the cloned shape's frame, in points.IShape.public final IShape insertClone(int index, IShape sourceShape)
Creates a copy of the specified shape and inserts it into the shape collection at the specified index. The cloned shape retains the original's position and size.
insertClone in interface IShapeCollectionindex - The zero-based index at which to insert the cloned shape.sourceShape - The IShape to clone.IShape.public final void copyTo(com.aspose.ms.System.Array array,
int index)
Copies all elements from the collection to the specified array.
copyTo in interface com.aspose.ms.System.Collections.ICollection<IShape>array - Target array.index - Starting index in the target array.public final boolean isSynchronized()
Returns a value indicating whether access to the collection is synchronized (thread-safe).
Read-only boolean.
isSynchronized in interface com.aspose.ms.System.Collections.ICollection<IShape>public final java.lang.Object getSyncRoot()
Returns a synchronization root.
Read-only Object.
getSyncRoot in interface com.aspose.ms.System.Collections.ICollection<IShape>Copyright © 2004-2025 Aspose Pty Ltd. All Rights Reserved.