We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Question about the connector

Quuestions about Aspose Slide

Problems of connetted line between a figure and a figure
My firm thinking of buying your library for making simply powerpoint files.
Before buying it, I used your demo library.

When I using it, found the ploblem of following.

[source code]


Presentation pres = new Presentation();
Slide slide=pres.addEmptySlide();

‘’’

PictureFrame pf1 = slide.getShapes().addPictureFrame(picId1, 0,0, pictureWidth+200, pictureHeight+200);
PictureFrame pf2 = slide.getShapes().addPictureFrame(picId2, 0,0, pictureWidth+200, pictureHeight+200);
Connector connector=
slide.getShapes().addConnector(ConnectorType.STRAIGHT, new Point2D.Float(0, 0),new Point2D.Float(500, 500));
AutoShapePath path = (AutoShapePath)connector.getPaths ().get(0);

connector.getLineFormat().setBeginArrowheadStyle(LineArrowheadStyle.OPEN);
connector.getPaths().contains(pf1);
connector.getPaths().contains(pf2);

connector.connectBegin( pf1 , 0 );
connector.connectEnd( pf2 , 3 );


Such as source code above, I created connector that conneting bwtween PictureFrame and PictureFrame.
Then, cnnector was set value.
And I checked a normal result at the PowerPoint Application.

But when a figure was dragged at somewhere in the slide, connector wasn’t followed.
I checked that connector color is red that means normally connected between a figure and line.


http://schemas.openxmlformats.org/presentationml/2006/main"
xmlns:main1="http://schemas.openxmlformats.org/drawingml/2006/main">

Hi Kim,


Thanks for considering Aspose.Slides.

I have observed the requirements shared by you and have worked with your code using Aspose.Slides for Java 2.7.0. The presentation generated withholds the connector when the shape is moved in PowerPoint. For your kind reference, I have attached the code snippet used along with generated presentation. Please share, if I may help you further in this regard.

Presentation pres = new Presentation();
Slide slide=pres.addEmptySlide();
//Creating a stream to hold the image file
InputStream iStream = new BufferedInputStream(new FileInputStream(“C:\Users\Public\Pictures\Sample Pictures\Desert.jpg”));

//Creating a picture object
com.aspose.slides.Picture pic = new com.aspose.slides.Picture(pres, iStream);


//Adding the picture object to pictures collection of the presentation
//After the picture object is added, the picture is given a uniqe picture Id
int picId = pres.getPictures().add(pic);


com.aspose.slides.PictureFrame pf1 = slide.getShapes().addPictureFrame(picId, 10,20, 700, 700);
com.aspose.slides.PictureFrame pf2 = slide.getShapes().addPictureFrame(picId, 3700,3500, 700, 700);
// com.aspose.slides.Rectangle pf1 = slide.getShapes().addRectangle(10,30, 110, 100);
// com.aspose.slides.Rectangle pf2 = slide.getShapes().addRectangle( 100,220, 200, 200);


Connector connector=
slide.getShapes().addConnector(ConnectorType.STRAIGHT, new java.awt.geom.Point2D.Float(0, 0),new java.awt.geom.Point2D.Float(500, 500));
//AutoShapePath path = (AutoShapePath)connector.getPaths ().get(0);
connector.getLineFormat().setBeginArrowheadStyle(LineArrowheadStyle.OPEN);
connector.getPaths().contains(pf1);
connector.getPaths().contains(pf2);

connector.connectBegin( pf1 , 0 );
connector.connectEnd( pf2 , 3 );
pres.write(“D:\Aspose Data\Connector.ppt”);

Many Thanks,