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

Free Support Forum - aspose.com

Removing Header-Footer from Slides

Hi,


If there is a way in which we can remove header-footer from the slide.
I am using Aspose.Slides .Net 15.2.0.0

Thanks
Garima

Hi Garima,

I have observed your requirements and like to share that you can remove the header-footers from slides. They are actually defined in slide master; so you need to access master slide to remove them. 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 RemoveSlideHeaders()
{
String path=“D:\Aspose Data\”;

Presentation pres = new Presentation(path + “TestMaster.pptx”);
foreach(IMasterSlide master in pres.Masters)
{
//foreach(IShape shape in master.Shapes)
int cnt=master.Shapes.Count;
for (int i=0;i<cnt;i++)
{
IShape shape =master.Shapes[i];
if (shape is IAutoShape)
{
IAutoShape ashp = (IAutoShape)shape;
if (ashp.Placeholder.Type == PlaceholderType.Footer || ashp.Placeholder.Type == PlaceholderType.Header)
{
master.Shapes.Remove(ashp);
cnt–;
}
}


}

}
pres.Save(path + “RemovedMaster.pptx”, SaveFormat.Pptx);

}

Many Thanks,

Hi,


Thanks for replying.

I tried to remove the header, footer, date-time, using the code written by you.
But its not removing any data from the slides. I am converting from .ppt to .pptx, and the converted file crashes while opening.

The ppt file was created in office 2010 and now after conversion its opening in 2013.

If I manually go to Header-footer option in office 2013 for 2010 ppt file, remove all the fields ,apply all, and then try to change it to pptx, then it works fine. Even if I re-insert the header-footer in .ppt and then convert it to pptx, still it works.

Can you please help. If there is any compatibility option?

Thanks,
Garima

Hi Garima,

I have observed the feedback shared by you and request you to please share the working sample project, source presentation and slide snapshot highlighting what you want to remove from slide. I will be able to investigate the issue further on my end on availability of requested information from your side. Please share so that I may proceed further with my investigation.

Many Thanks,