Setting border color of ShapeEx

Hi,

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

ShapeEx.getLineFormat().getFillFormat().setSolidFillColor(someColor);

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
shp.getFillFormat().setFillType(FillTypeEx.Solid);

//Set the color of the rectangle
shp.getFillFormat().getSolidFillColor().setColor(Color.yellow);

shp.getLineFormat().setWidth(4d);
shp.getLineFormat().getFillFormat().setFillType(FillTypeEx.Solid);
shp.getLineFormat().getFillFormat().getSolidFillColor().setColor(Color.RED);
//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.

Mudassir,

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.

Micky

Hi Micky,


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

Many Thanks,