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?
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.
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);
I hope this will be helpful. Please share if I may help you further in this regard.