Extract Header Footer from Presentation using Apache POI and Aspose.Slides
Contents
[
Hide
]
Aspose.Slides - Extract Header Footer from Presentation
The method getHeaderFooterManager() gives you access to Headers and Footers using Aspose.Slides API.
sourcePres.getSlides().get_Item(0).getHeaderFooterManager().isDateTimeVisible();
sourcePres.getSlides().get_Item(0).getHeaderFooterManager().isFooterVisible();
sourcePres.getSlides().get_Item(0).getHeaderFooterManager().isSlideNumberVisible();
Apache POI SL - HSLF XSLF - Extract Header Footer from Presentation
HeadersFooters class getters to access header and footer using Apache POI SL - HSLF XSLF
//presentation-scope headers / footers
HeadersFooters hdd = ppt.getSlideHeadersFooters();
if(hdd.isFooterVisible())
{
String footerText = hdd.getFooterText();
}
//per-slide headers / footers
for (int i=0; i < slides.length; i++)
{
HeadersFooters hdd2 = slides[i].getHeadersFooters();
if(hdd2.isFooterVisible())
{
String footerText = hdd2.getFooterText();
System.out.println(footerText + footerText);
}
if(hdd2.isUserDateVisible())
{
String customDate = hdd2.getDateTimeText();
System.out.println(customDate + customDate);
}
if(hdd2.isSlideNumberVisible())
{
int slideNUm = slides[i].getSlideNumber();
System.out.println(slideNUm + slideNUm);
}
}
Download Running Code
Download Sample Code
For more details, visit How to Add Header Footer in a Presentation.