Beispiel #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, Legacy.Text.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) {
            }
        }
Beispiel #2
0
 /**
  * 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, Legacy.Text.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);
 }
 /**
  * Initialises the RtfDocumentHeader.
  */
 protected internal void Init()
 {
     this.codePage          = new RtfCodePage(this.document);
     this.colorList         = new RtfColorList(this.document);
     this.fontList          = new RtfFontList(this.document);
     this.listTable         = new RtfListTable(this.document);
     this.stylesheetList    = new RtfStylesheetList(this.document);
     this.infoGroup         = new RtfInfoGroup(this.document);
     this.protectionSetting = new RtfProtectionSetting(this.document);
     this.pageSetting       = new RtfPageSetting(this.document);
     this.header            = new RtfHeaderFooterGroup(this.document, HF.RtfHeaderFooter.TYPE_HEADER);
     this.footer            = new RtfHeaderFooterGroup(this.document, HF.RtfHeaderFooter.TYPE_FOOTER);
     this.generator         = new RtfGenerator(this.document);
 }
Beispiel #4
0
        /**
         * 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(Legacy.Text.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;
            }
        }
 /**
  * Converts a HeaderFooter into a RtfHeaderFooterGroup. Depending on which class
  * the HeaderFooter is, the correct RtfHeaderFooterGroup is created.
  *
  * @param hf The HeaderFooter to convert.
  * @param type Whether the conversion is being done on a footer or header
  * @return The converted RtfHeaderFooterGroup.
  * @see com.lowagie.text.rtf.headerfooter.RtfHeaderFooter
  * @see com.lowagie.text.rtf.headerfooter.RtfHeaderFooterGroup
  */
 private RtfHeaderFooterGroup ConvertHeaderFooter(Legacy.Text.HeaderFooter hf, int type)
 {
     if (hf != null)
     {
         if (hf is RtfHeaderFooterGroup)
         {
             return(new RtfHeaderFooterGroup(this.document, (RtfHeaderFooterGroup)hf, type));
         }
         else if (hf is RtfHeaderFooter)
         {
             return(new RtfHeaderFooterGroup(this.document, (RtfHeaderFooter)hf, type));
         }
         else
         {
             return(new RtfHeaderFooterGroup(this.document, hf, type));
         }
     }
     else
     {
         return(new RtfHeaderFooterGroup(this.document, type));
     }
 }
 /**
  * Sets the current footer to use
  *
  * @param footer The HeaderFooter to use as footer
  */
 public void SetFooter(Legacy.Text.HeaderFooter footer)
 {
     this.footer = footer;
 }
 /**
  * Sets the current header to use
  *
  * @param header The HeaderFooter to use as header
  */
 public void SetHeader(Legacy.Text.HeaderFooter header)
 {
     this.header = header;
 }
 /**
 * Initialises the RtfDocumentHeader.
 */
 protected internal void Init()
 {
     this.codePage = new RtfCodePage(this.document);
     this.colorList = new RtfColorList(this.document);
     this.fontList = new RtfFontList(this.document);
     this.listTable = new RtfListTable(this.document);
     this.stylesheetList = new RtfStylesheetList(this.document);
     this.infoGroup = new RtfInfoGroup(this.document);
     this.protectionSetting = new RtfProtectionSetting(this.document);
     this.pageSetting = new RtfPageSetting(this.document);
     this.header = new RtfHeaderFooterGroup(this.document, HF.RtfHeaderFooter.TYPE_HEADER);
     this.footer = new RtfHeaderFooterGroup(this.document, HF.RtfHeaderFooter.TYPE_FOOTER);
     this.generator = new RtfGenerator(this.document);
 }
 /**
 * Sets the current header to use
 *
 * @param header The HeaderFooter to use as header
 */
 public void SetHeader(Legacy.Text.HeaderFooter header)
 {
     this.header = header;
 }
 /**
 * Sets the current footer to use
 *
 * @param footer The HeaderFooter to use as footer
 */
 public void SetFooter(Legacy.Text.HeaderFooter footer)
 {
     this.footer = footer;
 }