Setting Transparency of Rectangle Shape Solid fill color

Hi,
I want to set the transparency as 50% of rectangle shape with solid fill. Can you tell me how can I do that. This option is available in powerpoint.Capture1.JPG (23.3 KB)

@Rutuja,

I have observed your requirement and like to share that alpha value ranges from 0 to 255. 0 mean completely transparent and 255 mean no transparency. The 50% transparency means that you need to set alpha value to 128. Please try using following sample code to serve the purpose.

    public static void SetTransparentColor()
    {
        //Instantiate a Presentation object that represents a PPT file
        Presentation pres = new Presentation();

        //Accessing a slide using its slide position
        ISlide slide = pres.Slides[0];

        //Adding a rectangle shape into the slide by defining its X,Y postion, width
        //and height
        IAutoShape rect = slide.Shapes.AddAutoShape(ShapeType.Rectangle, 10, 10, 300, 200);

        rect.FillFormat.FillType = FillType.Solid;

        int opacity = 100;
        int alpha = 128, red = 255, green = 0, blue = 0;

        rect.FillFormat.SolidFillColor.Color = System.Drawing.Color.FromArgb(opacity, Color.Red);
        
   //Writing the presentation as a PPT file
        pres.Save("C:\\Aspose Data\\TestTransparent.pptx",Aspose.Slides.Export.SaveFormat.Pptx);
    }

Hi,
Can you provide code in java

@Rutuja,

I have observed your comments. I have shared sample code in java. Please check and share feedback with us if there is still an issue.

public static void setTransparentColor()
{

     Presentation pres = new Presentation(path+"Test.pptx");

   
     ISlide slide = pres.getSlides().get_Item(0);

   
     IAutoShape rect = slide.getShapes().addAutoShape(ShapeType.Rectangle, 10, 10, 300, 200);

     rect.getFillFormat().setFillType(FillType.Solid);

     int alpha = 128, red = 255, green = 0, blue = 0;

     rect.getFillFormat().getSolidFillColor().setColor(new Color(red, green, blue, alpha));
     
     //Writing the presentation as a PPT file
     pres.save(path+"TestTransparent.pptx", SaveFormat.Pptx);
 }