/** * Set a RtfHeaderFooter to be displayed at a certain position * * @param headerFooter The RtfHeaderFooter to display * @param displayAt The display location to use */ public void SetHeaderFooter(RtfHeaderFooter headerFooter, int displayAt) { this.mode = MODE_MULTIPLE; headerFooter.SetRtfDocument(this.document); headerFooter.SetType(this.type); headerFooter.SetDisplayAt(displayAt); switch (displayAt) { case RtfHeaderFooter.DISPLAY_ALL_PAGES: headerAll = headerFooter; break; case RtfHeaderFooter.DISPLAY_FIRST_PAGE: headerFirst = headerFooter; break; case RtfHeaderFooter.DISPLAY_LEFT_PAGES: headerLeft = headerFooter; break; case RtfHeaderFooter.DISPLAY_RIGHT_PAGES: headerRight = headerFooter; break; } }
/** * Set that this RtfHeaderFooterGroup should have facing pages. If only * a header / footer for all pages exists, then it will be copied to the left * and right pages aswell. */ public void SetHasFacingPages() { if (this.mode == MODE_SINGLE) { this.mode = MODE_MULTIPLE; this.headerLeft = new RtfHeaderFooter(this.document, this.headerAll, RtfHeaderFooter.DISPLAY_LEFT_PAGES); this.headerLeft.SetType(this.type); this.headerRight = new RtfHeaderFooter(this.document, this.headerAll, RtfHeaderFooter.DISPLAY_RIGHT_PAGES); this.headerRight.SetType(this.type); this.headerAll = null; } else if (this.mode == MODE_MULTIPLE) { if (this.headerLeft == null && this.headerAll != null) { this.headerLeft = new RtfHeaderFooter(this.document, this.headerAll, RtfHeaderFooter.DISPLAY_LEFT_PAGES); this.headerLeft.SetType(this.type); } if (this.headerRight == null && this.headerAll != null) { this.headerRight = new RtfHeaderFooter(this.document, this.headerAll, RtfHeaderFooter.DISPLAY_RIGHT_PAGES); this.headerRight.SetType(this.type); } this.headerAll = null; } }
/// <summary> /// Set a RtfHeaderFooter to be displayed at a certain position /// </summary> /// <param name="headerFooter">The RtfHeaderFooter to display</param> /// <param name="displayAt">The display location to use</param> public void SetHeaderFooter(RtfHeaderFooter headerFooter, int displayAt) { _mode = ModeMultiple; headerFooter.SetRtfDocument(_document); headerFooter.SetType(_type); headerFooter.SetDisplayAt(displayAt); switch (displayAt) { case RtfHeaderFooter.DISPLAY_ALL_PAGES: _headerAll = headerFooter; break; case RtfHeaderFooter.DISPLAY_FIRST_PAGE: _headerFirst = headerFooter; break; case RtfHeaderFooter.DISPLAY_LEFT_PAGES: _headerLeft = headerFooter; break; case RtfHeaderFooter.DISPLAY_RIGHT_PAGES: _headerRight = headerFooter; break; } }
/// <summary> /// Set that this RtfHeaderFooterGroup should have facing pages. If only /// a header / footer for all pages exists, then it will be copied to the left /// and right pages aswell. /// </summary> public void SetHasFacingPages() { if (_mode == ModeSingle) { _mode = ModeMultiple; _headerLeft = new RtfHeaderFooter(_document, _headerAll, RtfHeaderFooter.DISPLAY_LEFT_PAGES); _headerLeft.SetType(_type); _headerRight = new RtfHeaderFooter(_document, _headerAll, RtfHeaderFooter.DISPLAY_RIGHT_PAGES); _headerRight.SetType(_type); _headerAll = null; } else if (_mode == ModeMultiple) { if (_headerLeft == null && _headerAll != null) { _headerLeft = new RtfHeaderFooter(_document, _headerAll, RtfHeaderFooter.DISPLAY_LEFT_PAGES); _headerLeft.SetType(_type); } if (_headerRight == null && _headerAll != null) { _headerRight = new RtfHeaderFooter(_document, _headerAll, RtfHeaderFooter.DISPLAY_RIGHT_PAGES); _headerRight.SetType(_type); } _headerAll = null; } }
/** * Constructs a RtfHeaderGroup for a certain HeaderFooter * * @param doc The RtfDocument this RtfHeaderFooter belongs to * @param headerFooter The HeaderFooter to display * @param type The typ of RtfHeaderFooterGroup to create */ public RtfHeaderFooterGroup(RtfDocument doc, HeaderFooter headerFooter, int type) : base(new Phrase(""), false) { this.document = doc; this.type = type; this.mode = MODE_SINGLE; headerAll = new RtfHeaderFooter(doc, headerFooter, type, RtfHeaderFooter.DISPLAY_ALL_PAGES); headerAll.SetType(this.type); }
/// <summary> /// Constructs a RtfHeaderGroup for a certain HeaderFooter /// </summary> /// <param name="doc">The RtfDocument this RtfHeaderFooter belongs to</param> /// <param name="headerFooter">The HeaderFooter to display</param> /// <param name="type">The typ of RtfHeaderFooterGroup to create</param> public RtfHeaderFooterGroup(RtfDocument doc, HeaderFooter headerFooter, int type) : base(new Phrase(""), false) { _document = doc; _type = type; _mode = ModeSingle; _headerAll = new RtfHeaderFooter(doc, headerFooter, type, RtfHeaderFooter.DISPLAY_ALL_PAGES); _headerAll.SetType(_type); }
/** * Set that this RtfHeaderFooterGroup should have a title page. If only * a header / footer for all pages exists, then it will be copied to the * first page aswell. */ public void SetHasTitlePage() { if (this.mode == MODE_SINGLE) { this.mode = MODE_MULTIPLE; headerFirst = new RtfHeaderFooter(this.document, headerAll, RtfHeaderFooter.DISPLAY_FIRST_PAGE); headerFirst.SetType(this.type); } }
/// <summary> /// Set that this RtfHeaderFooterGroup should have a title page. If only /// a header / footer for all pages exists, then it will be copied to the /// first page aswell. /// </summary> public void SetHasTitlePage() { if (_mode == ModeSingle) { _mode = ModeMultiple; _headerFirst = new RtfHeaderFooter(_document, _headerAll, RtfHeaderFooter.DISPLAY_FIRST_PAGE); _headerFirst.SetType(_type); } }
/** * Constructs a RtfHeaderFooter as a copy of an existing RtfHeaderFooter. * For internal use only. * * @param doc The RtfDocument this RtfHeaderFooter belongs to * @param headerFooter The RtfHeaderFooter to copy * @param displayAt The display location of this RtfHeaderFooter */ protected internal RtfHeaderFooter(RtfDocument doc, RtfHeaderFooter headerFooter, int displayAt) : base(new Phrase(""), false) { this.document = doc; this.content = headerFooter.GetContent(); this.displayAt = displayAt; for (int i = 0; i < this.content.Length; i++) { if (this.content[i] is IElement) { try { this.content[i] = this.document.GetMapper().MapElement((IElement)this.content[i]); } catch (DocumentException) { } } if (this.content[i] is IRtfBasicElement) { ((IRtfBasicElement)this.content[i]).SetInHeader(true); } } }
/** * Set a HeaderFooter to be displayed at a certain position * * @param headerFooter The HeaderFooter to set * @param displayAt The display location to use */ public void SetHeaderFooter(HeaderFooter headerFooter, int displayAt) { this.mode = MODE_MULTIPLE; switch (displayAt) { case RtfHeaderFooter.DISPLAY_ALL_PAGES: headerAll = new RtfHeaderFooter(this.document, headerFooter, this.type, displayAt); break; case RtfHeaderFooter.DISPLAY_FIRST_PAGE: headerFirst = new RtfHeaderFooter(this.document, headerFooter, this.type, displayAt); break; case RtfHeaderFooter.DISPLAY_LEFT_PAGES: headerLeft = new RtfHeaderFooter(this.document, headerFooter, this.type, displayAt); break; case RtfHeaderFooter.DISPLAY_RIGHT_PAGES: headerRight = new RtfHeaderFooter(this.document, headerFooter, this.type, displayAt); break; } }
/// <summary> /// Set a HeaderFooter to be displayed at a certain position /// </summary> /// <param name="headerFooter">The HeaderFooter to set</param> /// <param name="displayAt">The display location to use</param> public void SetHeaderFooter(HeaderFooter headerFooter, int displayAt) { _mode = ModeMultiple; switch (displayAt) { case RtfHeaderFooter.DISPLAY_ALL_PAGES: _headerAll = new RtfHeaderFooter(_document, headerFooter, _type, displayAt); break; case RtfHeaderFooter.DISPLAY_FIRST_PAGE: _headerFirst = new RtfHeaderFooter(_document, headerFooter, _type, displayAt); break; case RtfHeaderFooter.DISPLAY_LEFT_PAGES: _headerLeft = new RtfHeaderFooter(_document, headerFooter, _type, displayAt); break; case RtfHeaderFooter.DISPLAY_RIGHT_PAGES: _headerRight = new RtfHeaderFooter(_document, headerFooter, _type, displayAt); break; } }
/** * Constructs a RtfHeaderFooterGroup by copying the content of the original * RtfHeaderFooterGroup * * @param doc The RtfDocument this RtfHeaderFooter belongs to * @param headerFooter The RtfHeaderFooterGroup to copy * @param type The type of RtfHeaderFooterGroup to create */ public RtfHeaderFooterGroup(RtfDocument doc, RtfHeaderFooterGroup headerFooter, int type) : base(new Phrase(""), false) { this.document = doc; this.mode = headerFooter.GetMode(); this.type = type; if (headerFooter.GetHeaderAll() != null) { this.headerAll = new RtfHeaderFooter(this.document, headerFooter.GetHeaderAll(), RtfHeaderFooter.DISPLAY_ALL_PAGES); } if (headerFooter.GetHeaderFirst() != null) { this.headerFirst = new RtfHeaderFooter(this.document, headerFooter.GetHeaderFirst(), RtfHeaderFooter.DISPLAY_FIRST_PAGE); } if (headerFooter.GetHeaderLeft() != null) { this.headerLeft = new RtfHeaderFooter(this.document, headerFooter.GetHeaderLeft(), RtfHeaderFooter.DISPLAY_LEFT_PAGES); } if (headerFooter.GetHeaderRight() != null) { this.headerRight = new RtfHeaderFooter(this.document, headerFooter.GetHeaderRight(), RtfHeaderFooter.DISPLAY_RIGHT_PAGES); } SetType(this.type); }
/// <summary> /// Constructs a RtfHeaderFooter as a copy of an existing RtfHeaderFooter. /// For internal use only. /// </summary> /// <param name="doc">The RtfDocument this RtfHeaderFooter belongs to</param> /// <param name="headerFooter">The RtfHeaderFooter to copy</param> /// <param name="displayAt">The display location of this RtfHeaderFooter</param> protected internal RtfHeaderFooter(RtfDocument doc, RtfHeaderFooter headerFooter, int displayAt) : base(new Phrase(""), false) { _document = doc; _content = headerFooter.getContent(); _displayAt = displayAt; for (var i = 0; i < _content.Length; i++) { if (_content[i] is IElement) { try { _content[i] = _document.GetMapper().MapElement((IElement)_content[i])[0]; } catch (DocumentException) { } } if (_content[i] is IRtfBasicElement) { ((IRtfBasicElement)_content[i]).SetInHeader(true); } } }