Free Support Forum -

Setting border color of ShapeEx


I'm trying to set the border color of a ShapeEx. This is the code i use:


but the resulting shape in the pptx has a black border and not someColor.

Can you help me out ?

Regards, Micky

Hi Micky,

Please use the following code snippet to set the color for the border of the shape. Please share, if I may help you further in this regard.

public static void genShape() throws Exception
//Instantiate PrseetationEx class that represents the PPTX
PresentationEx pres = new PresentationEx();

//Get the first slide
SlideEx sld = pres.getSlides().get_Item(0);

//Add autoshape of rectangle type
int idx = sld.getShapes().addAutoShape(ShapeTypeEx.Rectangle, 50, 150, 75, 150);
ShapeEx shp = sld.getShapes().get_Item(idx);

//Set the fill type to Solid

//Set the color of the rectangle

//Write the PPTX file to disk
pres.write(“d:\Aspose Data\RectShpSolid.pptx”);

Many Thanks,

Hi Mudassir,

We use aspose.slides java 2.9.1. The statement: shp.getLineFormat().getFillFormat().getSolidFillColor().setColor(Color.RED); has no effect. The border color stays black.

Regards, Micky

P.S. In our case we manipulate an existing shape instead of creating a new one.


I have found the problem and the solution. It seems that we also copied shape properties in our code and there we discarded some FillFormat properties.

Sorry to bother you about this.


Hi Micky,

No problem dear, you are always welcome. Please share, if I may help you further in this regard.

Many Thanks,