/**
* Constructs a RtfHeaderFooter for a HeaderFooter.
*
* @param doc The RtfDocument this RtfHeaderFooter belongs to
* @param headerFooter The HeaderFooter to base this RtfHeaderFooter on
*/
protected internal RtfHeaderFooter(RtfDocument doc, HeaderFooter headerFooter)
: base(new Phrase(""), false)
{
this.document = doc;
Paragraph par = new Paragraph();
par.Alignment = headerFooter.Alignment;
if (headerFooter.Before != null) {
par.Add(headerFooter.Before);
}
if (headerFooter.IsNumbered()) {
par.Add(new FD.RtfPageNumber(this.document));
}
if (headerFooter.After != null) {
par.Add(headerFooter.After);
}
try {
this.content = new Object[1];
this.content[0] = doc.GetMapper().MapElement(par)[0];
((IRtfBasicElement) this.content[0]).SetInHeader(true);
} catch (DocumentException) {
}
}