IsNumbered() public method

Checks if the HeaderFooter contains a page number.
public IsNumbered ( ) : bool
return bool
コード例 #1
0
 /**
 * 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) {
     }
 }
コード例 #2
0
ファイル: RtfWriter.cs プロジェクト: hjgode/iTextSharpCF
 /**
 * Write a <code>HeaderFooter</code> to a <code>MemoryStream</code>
 *
 * @param headerFooter  The <code>HeaderFooter</code> object to be written.
 * @param hfType        The type of header or footer to be added.
 * @param target        The <code>MemoryStream</code> to which the <code>HeaderFooter</code> will be written.
 * @throws IOException
 */
 private void WriteHeaderFooter(HeaderFooter headerFooter, byte[] hfType, MemoryStream target)
 {
     inHeaderFooter = true;
     try {
         target.WriteByte(openGroup);
         target.WriteByte(escape);
         target.Write(hfType, 0, hfType.Length);
         target.WriteByte(delimiter);
         if (headerFooter != null) {
             if (headerFooter is RtfHeaderFooter && ((RtfHeaderFooter) headerFooter).Content() != null) {
                 this.AddElement(((RtfHeaderFooter) headerFooter).Content(), target);
             } else {
                 Paragraph par = new Paragraph();
                 par.Alignment = headerFooter.Alignment;
                 if (headerFooter.Before != null) {
                     par.Add(headerFooter.Before);
                 }
                 if (headerFooter.IsNumbered()) {
                     par.Add(new RtfPageNumber("", headerFooter.Before.Font));
                 }
                 if (headerFooter.After != null) {
                     par.Add(headerFooter.After);
                 }
                 this.AddElement(par, target);
             }
         }
         target.WriteByte(closeGroup);
     } catch (DocumentException e) {
         throw new IOException("DocumentException - " + e.ToString());
     }
     inHeaderFooter = false;
 }