PPTX font shadow supprot

Hi,

Is there in api for pptx support for font shadows? And how I can use it to read shadows and set new ones? I do not found nothing in api for shadows support.

Thanks,

Zeljko

Hi Zeljko,

Thanks for your interest in Aspose.Slides.

The font shadow is supported in Aspose.Slides for Java, but on shapes. level. Please follow this document link for the desired code example. You can also visit this forum thread link for further information.

Thanks and Regards,

Hi,

I still have have problem with shadow property. I used following code:

PresentationEx presentation = new PresentationEx(“d:/pptx/shadow.pptx”);

SlideEx slide = presentation.getSlides().get(0);

ShapesEx shapes = slide.getShapes();

ShapeEx shape = shapes.get(0);

AutoShapeEx ashape = (AutoShapeEx) shape;

FillTypeEx fillType = ashape.getFillFormat().getFillType();

if (fillType == FillTypeEx.NOFILL) {
System.out.println(“No fill type.”);
} else {
System.out.println(fillType.getName());
}

and I got NOT_DEFINED fill type. Your example said that I should get NOFILL fill type. Am I missing something?

shadow.pptx is in attachment.

Thanks,
Zeljko

Hi,

I have one more question. If I have shadow defined on some part of text (not for all text) in AutoShapeEx, then I remove all portions from paragraph and add new portion, shadow is disappear. I used following code:

PresentationEx presentation = new PresentationEx(“d:/pptx/shadow-test2.pptx”);

SlideEx slide = presentation.getSlides().get(0);

ShapesEx shapes = slide.getShapes();

ShapeEx shape = shapes.get(0);

AutoShapeEx ashape = (AutoShapeEx) shape;

TextFrameEx tf = ashape.getTextFrame();

if(tf != null) {
ParagraphsEx paragraphs = tf.getParagraphs();

ParagraphEx paragraph = paragraphs.get(0);

PortionsEx portions = paragraph.getPortions();

PortionEx portion = portions.get(0);

portions.clear();

PortionEx newPortion = new PortionEx();

newPortion.setText(“T_” + portion.getText());

portions.add(newPortion);
}

presentation.write(“d:/pptx/new-shadow-test2.pptx”);

shadow-test.pptx is in attachment.

Thanks,
Zeljko

Hi Zeljko,

I have observed the code snippet provided by you. The code snippet has no problem. You are getting NOT_DEFINED FillType because it is the one that has been set in the presentation's slide text frame. For your kind reference, I have attached the PPTX file in which I programmatically changed the FillType to your desired NOFILL FillType and it worked fine.

Thanks and Regards,

Hi Zeljko,

Actually, when you clear all the portions inside a paragraph of the text frame then all the formatting information also get cleared. That is why after removal of all the portions, you are not able to retain the shadow related properties.

Thanks and Regards,

Hi,

I was followed instruction described by link and I cannot reproduce it Java code. Can you provide me Java code sample?

Zeljko

Hi Zeljko,

I have generated the code for font shadow effects in Java. Please use the code snippet given below to serve the purpose.

PresentationEx Pres = new PresentationEx();
//Get first slide
SlideEx Slide = Pres.getSlides().get(0);
//Add an AutoShape of Rectangle type
int iIdx = Slide.getShapes().addAutoShape(ShapeTypeEx.RECTANGLE, 150, 75, 150, 50);
AutoShapeEx aShp = (AutoShapeEx)Slide.getShapes().get(iIdx);
//Add TextFrame to the Rectangle
aShp.addTextFrame("Aspose TextBox");
// Disable shape fill in case we want to get shadow of text.
aShp.getFillFormat().setFillType( FillTypeEx.NOFILL);
// Add outer shadow and set all necessary parameters
OuterShadow Shadow = new OuterShadow();
aShp.getEffectFormat().setOuterShadowEffect(shadow);
Shadow.setBlurRadius(4.0);
Shadow.setDirection(45);
Shadow.setDistance(3);
Shadow.setRectangleAlign(RectangleAlignmentEx.TOP_LEFT);
Shadow.getShadowColor().setColor(Color.BLACK);

//Write the presentation to disk
Pres.write("d:\\ppt\\ShadowPres.pptx");

Thanks and Regards,

Hi,

Is it possible to create font’s shadows in version 2.1.0, and can you provide me code sample? I am facing NullPoiterExceptions in version 2.2.0 (it is not usable).

Thanks,
Zeljko

Hi,
Just reading font’s shadow will be good for me, even reading does portion have shadow will be good enough.

Thanks,
Zeljko

Hi Zeljko,

I regret to inform you that the said feature is unavailable in Aspose.Slides for Java 2.1.0. It was implemented and made available in Aspose.Slides for Java 2.2.0.

We are greatly sorry for your inconvenience,

Hi,

Is there a chance to you release hotfix for Slides 2.2.0 (NullPointerException in PortionEx.getFontHeight())?

Thanks,
Zeljko

Hi Zeljko,

If I am right you might have pointed towards the resolution of issue 11698. I regret to inform you that the issue is still not resolved. We will share the information with you as soon as the issue is resolved.

We are sorry for your inconvenience,

@zeljkoar,

Using latest Aspose.Slides for Java 20.2, you can set the shadow effects on text. Please try using following example on your end.

    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);
    }