Text shadow effect

Hi,

how I can get shadow effect (properties of shadow effect) of text from my presentation?

Thanks

Hi,

You can use AutoShape.getEffectFormat().getOuterShadowEffect() and AutoShape.getInnerShadowEffect().getInnerShadowEffect() to get the shadow effect of Text and it’s properties.

Please see the following code to get Shadow Effect from text.

//Instantiate a PPTX class
PresentationEx presentation = new PresentationEx("d:\\data\\table.pptx");

//Get first slide
SlideEx slide= presentation.getSlides().get_Item(0);

// Get Text Frame
AutoShapeEx autoShape = (AutoShapeEx)slide.getShapes().get_Item(0);

//Get Shadow Effect
OuterShadow outerShadow = autoShape.getEffectFormat().getOuterShadowEffect();

//Print the color of Shadow Effect
System.out.println(outerShadow.getShadowColor().getColor());

Hopefully, it will help you achieve your desired results.

Thanks & Regards,
Owais Ahmad

@djordje,

You can please try using following sample code that is in accordance with latest Aspose.Slides for Java 20.7 API.

    public static void TestShadow()
    {
        //Create an instance of Presentation class
        Presentation pres = new Presentation();

        //Get reference of the slide
        ISlide sld = pres.getSlides().get_Item(0);

        //Add an AutoShape of Rectangle type
        IAutoShape ashp = sld.getShapes().addAutoShape(ShapeType.Rectangle, 150, 75, 150, 50);


        //Add TextFrame to the Rectangle
        ashp.addTextFrame("Aspose TextBox");

        // Disable shape fill in case we want to get shadow of text.
        ashp.getFillFormat().setFillType(FillType.NoFill);

        // Add outer shadow and set all necessary parameters
        ashp.getEffectFormat().enableOuterShadowEffect();
        IOuterShadow shadow = ashp.getEffectFormat().getOuterShadowEffect();
        shadow.setBlurRadius(4.0);
        shadow.setDirection (45);
        shadow.setDistance(3);
        shadow.setRectangleAlign((byte)RectangleAlignment.TopLeft);
        shadow.getShadowColor().setPresetColor(PresetColor.Black);

        //Write the presentation to disk
        pres.save("D:\\OutShadow.pptx", SaveFormat.Pptx);
    }