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

Free Support Forum - aspose.com

Unable to read Header/Footer correctly


slide.HeaderFooter.FooterText and HeaderText returns empty string, and it seems there is also a problem between slide footer and comments footer.

Also when I change text from Date or Footer or Header, I must store values from IsFooterVisible (and others) and set them after text has been changed. Why ?

Thank you for a quick answer

Please provide me your source code and source presentation to look into this issue.

Here it is :

m_Presentation = new Presentation(“TestHeader.ppt”);

Slide slide = null;
int nb_slides = m_Presentation.Slides.Count;

for (int nb_slide = 0; nb_slide < nb_slides; nb_slide++)
slide = m_Presentation.GetSlideByPosition(nb_slide);

Debug.WriteLine(“DateTimeText[” + nb_slide + "] : " + slide.HeaderFooter.DateTimeText);
slide.HeaderFooter.DateTimeText = slide.HeaderFooter.DateTimeText;
Debug.WriteLine(“HeaderText[” + nb_slide + "] : " + slide.HeaderFooter.HeaderText);
slide.HeaderFooter.HeaderText = slide.HeaderFooter.HeaderText;
Debug.WriteLine(“HeaderFooter[” + nb_slide + "] : " + slide.HeaderFooter.FooterText);
slide.HeaderFooter.FooterText = slide.HeaderFooter.FooterText;
catch (NullReferenceException nre)
// Debug.WriteLine(nre.Message);

m_Presentation.Write(“TestHeader - modified.ppt”);

It seems to be a bug, because as soon as you write any of the HeaderFooter property, it resets all the properties.

I will report it for a fix.

However, your code should be like this. I have only shown the modifications, rest of code is ok.


int nb_slides = m_Presentation.Slides.LastSlidePosition;

for (int nb_slide = 1; nb_slide <= nb_slides; nb_slide++)


slide = m_Presentation.GetSlideByPosition(nb_slide);


Have you got a date for a fix ?

I am waiting to buy a licence and it doesn’t seems to be so fast for fixes, how can I say to my boss that I must wait many days to finish the project you know.


It is in queue and will be fixed in a week or two.

Have a nice day.

Sorry for delay but there is no bug. That is correct behavior. I should explain.
Presentations have 2 type of header/footer. The first one is defined on the master
slide and the second one can be defined separately for each slide in a ppt.

Your presentation TestHeader.ppt contains master header/footer only.
If you change header/footer for selected slide information will be stored in this slide but not in the master.
By default slide has all header/footer fields invisible and empty so if you would like to change it
you should set all necessary Is***Visible and ***Text properties.

I understand the theory, but can you modify or give a working example to manipulate all the headers please ?
It would be very very helpful to me :slight_smile:

That is very simple example to change header and footer:

slide.HeaderFooter.IsHeaderVisible = true;
slide.HeaderFooter.HeaderText = “Example Header Text”;

slide.HeaderFooter.IsFooterVisible = true;
slide.HeaderFooter.FooterText = “Example Footer Text”;

All other fields can be changed in the same way.

It is what I did, it is fine for first slide but on others slides the headers are not visible.

So how can I modify headers on the master slide to be modified everywhere ?

I don’t see these lines for each slide in your code example:

slide.HeaderFooter.IsHeaderVisible = true;
slide.HeaderFooter.IsFooterVisible = true;

Did you write it?

I added it to my sample after your suggestion, on my computer.

I just jave tried this code with your presentation.

int slnum = pres.Slides.LastSlidePosition;
for (int i = 1; i <= slnum; i++)
Slide sl = pres.GetSlideByPosition(i);
sl.HeaderFooter.IsPageNumberVisible = true;
sl.HeaderFooter.IsFooterVisible = true;
sl.HeaderFooter.FooterText = "Test footer number " + i;

Everything works fine. After running code each slide in the presentation
has page number and customized footer.

Yes of course there is no problem with your code.

My problem is to read all the informations about headers, and write them without losing some informations.