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

Free Support Forum - aspose.com

Header/Footer in Notes and Handouts => access/change?

Hi Aspose team,

is it possible to access header/footer in Notes and Handouts part of the presentation?
If you click on Insert => Header/Footer second tab is "Notes and Handouts".

At the end I would like to make changes in that are from code. Is this possible?

Thanks,
Oliver

Hi Oliver,


Thank you for your interest in Aspose.Slides.

I have observed your comments and like to request you to please try using following sample code on your end and then share your feedback with us.

Presentation pres = new Presentation();
pres.SlideSize.Orientation = SlideOrienation.Portrait;
pres.ViewProperties.LastView = ViewType.HandoutView;

IHeaderFooterManager hfManager = pres.HeaderFooterManager;
hfManager.IsDateTimeVisible = true;
hfManager.IsFooterVisible = true;
hfManager.IsSlideNumberVisible = true;

hfManager.SetVisibilityOnTitleSlide(true);
hfManager.SetFooterText(“Test Footer”);
pres.Save(“D:\TestHandout.pptx”, SaveFormat.Pptx);

I hope this will be helpful. Please share if I may help you further in this regard.

Best Regards,
Hi Adnan,

this works ok (I already tested).
If you go to Insert => Header/Footer second tab is "Notes and Handouts" there you can create Header and Footer that will appear in Notes and Handouts.

Question is is it possible to change this programmatically? If yes, how?

Thanks,
Oliver

Hi Oliver,


We are working over your requirements and discussing it with the product team. I will update you soon with our findings.

Best Regards,

Hi Oliver,

Following is the code to add header and footer as per your requirements. The code is working fine however the changes are not reflected in the dialog box which appears If you go to Insert => Header/Footer second tab is "Notes and Handouts". We are looking into this problem but for now please try using following sample code on your end and then share your kind feedback with us.

Presentation presentation = new Presentation(@"D:\handout_header_footer.pptx");

IMasterHandoutSlide masterHandoutSlide = presentation.MasterHandoutSlideManager.MasterHandoutSlide;

if (null != masterHandoutSlide)

{

IAutoShape myHeader = (IAutoShape)masterHandoutSlide.Shapes[0];

String tmpString = myHeader.TextFrame.Text;

myHeader.TextFrame.Text = "HI there new header";

IAutoShape myFooter = (IAutoShape)masterHandoutSlide.Shapes[2];

String tmpString2 = myFooter.TextFrame.Text;

myFooter.TextFrame.Text = "HI there new footer";

IPlaceholder placeholder = myHeader.Placeholder;

int plType = (int)placeholder.Type;

presentation.Save(@"D:\handout.pptx", SaveFormat.Pptx);

}

I hope this will be helpful. Please share if I may help you further in this regard.

Best Regards,

Hi Oliver,


I would like to request you to please try following sample code on your end to serve the purpose. This code is working fine as I have attached the source and generated file for your kind reference.

Presentation presentation = new Presentation("D:\\handout_header_footer.pptx");

IMasterHandoutSlide masterHandoutSlide = presentation.MasterHandoutSlideManager.MasterHandoutSlide;

if (masterHandoutSlide != null)

updateHeaderFooterText(masterHandoutSlide);

IMasterNotesSlide masterNotesSlide = presentation.MasterNotesSlideManager.MasterNotesSlide;

if (null != masterNotesSlide)

updateHeaderFooterText(masterNotesSlide);

foreach(ISlide slide in presentation.Slides)

{

INotesSlide notesSlide = slide.NotesSlideManager.NotesSlide;

if (null != notesSlide)

updateHeaderFooterText(notesSlide);

}

presentation.Save("D:\\handout_test_Java.pptx", SaveFormat.Pptx);

public void updateHeaderFooterText(IBaseSlide master)

{

foreach (IShape shape in master.Shapes)

{

if (shape.Placeholder != null)

{

if (shape.Placeholder.Type == PlaceholderType.Header)

((IAutoShape)shape).TextFrame.Text = "HI there new header";

if (shape.Placeholder.Type == PlaceholderType.Footer)

((IAutoShape)shape).TextFrame.Text = "HI there new footer";

}

}

}


I hope this will be helpful. Please share if I may help you further in this regard.

Best Regards,
Hi,

thanks for help.
I adjusted my coding and now everything works great.

Thanks,
Oliver

Hi Oliver,


Thank you for your valuable feedback.

We are glad to know that your issue is resolved and things have started working on your end.

Please feel free to contact us if we could be of any help to you.

Best Regards,