We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Cant add footer on version "Slides 14.4.0"

I try to add footer in a slide
I try to follow example code

HeaderFooter srcHF = srcSlide.getHeaderFooter();

but getHeaderFooter method does not exist on latest build.

Is there any workaround?

Hi Benjamin,

I have observed the requirements shared by you and like to share that you need to use IHeaderFooterManager class to work with footers in presentation. Please try using the following sample code on your end to serve the purpose. Please share if I may help you further in this regard.

public static void adddText()
{
//Instantiate Presentation class that represents PPTX
Presentation pres = new Presentation();

//Access first slide
ISlide sld = pres.getSlides().get_Item(0);
IHeaderFooterManager srcHF = pres.getHeaderFooterManager();
srcHF.isFooterVisible(true);
srcHF.setFooterText(“Footer Text”);

//Save the PPTX to Disk
pres.save(“D:\Aspose Data\NotesSlide.pptx”, SaveFormat.Pptx);
}

Many Thanks,

It works. Thank you

However, srcHF.isFooterVisible(true); should be srcHF.setFooterVisible(true);

Is there any way to change the footer size?

Hi Benjamin,

I like to share that you need to access the text frame of footer text and set the font related properties on portion level. Please visit this documentation section link for your reference.

Many Thanks,

[quote user=“Mudassir”]Hi Benjamin,

I like to share that you need to access the text frame of footer text and set the font related properties on portion level. Please visit this documentation section link for your reference.

Many Thanks,
[/quote]
The question is how do we access the text frame from footer. I have yet discovered a method to allow me to access it.

Hi Benjamin,

I have observed the requirement shared by you. Please try using the following sample code on your end to serve the purpose.

public static void adddFooterText()
{
//Instantiate Presentation class that represents PPTX
Presentation pres = new Presentation();

//Access first slide
ISlide sld = pres.getSlides().get_Item(0);
IHeaderFooterManager srcHF = pres.getHeaderFooterManager();
srcHF.setFooterVisible(true);
srcHF.setFooterText(“Footer Text”);
IShape shape=null;
for(int i=0;i<sld.getShapes().size();i++)
{
shape=sld.getShapes().get_Item(i);
IPlaceholder place=shape.getPlaceholder();
if(place!=null&& place.getType()==PlaceholderType.Footer)
{


ITextFrame text=((IAutoShape)shape).getTextFrame();
if(text!=null)
{
IPortion port=text.getParagraphs().get_Item(0).getPortions().get_Item(0);
port.getPortionFormat().setFontHeight(10f);
port.getPortionFormat().setFontItalic(NullableBool.True);
port.getPortionFormat().setFontBold(NullableBool.True);
port.getPortionFormat().getFillFormat().setFillType(FillType.Solid);
port.getPortionFormat().getFillFormat().getSolidFillColor().setColor(java.awt.Color.RED);

}

}
}


//Save the PPTX to Disk
pres.save(“D:\Aspose Data\NotesSlide.pptx”, SaveFormat.Pptx);
}


Please share, if I may help you further in this regard.

Many Thanks,

I try to use the code when I generate new power point slide. But it has no effect on the footer.

Hi Benjamin,


I like to share that if you are trying to save the presentation as PPT then yes there is an issue. I have already logged an issue with ID SLIDESJAVA-34437 in our issue tracking system to resolve the issue. I suggest you please try saving presentation as PPTX for the time being to see the effect.

Many Thanks,

[quote user=“Mudassir”]Hi Benjamin,


I like to share that if you are trying to save the presentation as PPT then yes there is an issue. I have already logged an issue with ID SLIDESJAVA-34437 has been created to resolve the issue. I suggest you please try saving presentation as PPTX for the time being to see the effect.

Many Thanks,
[/quote]
Thanks for the prompt reply.