/// <summary>
 /// Writes the section definition data
 /// </summary>
 /// <param name="result"></param>
 public void WriteSectionDefinition(Stream result)
 {
     try
     {
         RtfHeaderFooterGroup header = convertHeaderFooter(_header, RtfHeaderFooter.TYPE_HEADER);
         RtfHeaderFooterGroup footer = convertHeaderFooter(_footer, RtfHeaderFooter.TYPE_FOOTER);
         if (header.HasTitlePage() || footer.HasTitlePage())
         {
             result.Write(_titlePage, 0, _titlePage.Length);
             header.SetHasTitlePage();
             footer.SetHasTitlePage();
         }
         if (header.HasFacingPages() || footer.HasFacingPages())
         {
             result.Write(_facingPages, 0, _facingPages.Length);
             header.SetHasFacingPages();
             footer.SetHasFacingPages();
         }
         footer.WriteContent(result);
         header.WriteContent(result);
         _pageSetting.WriteSectionDefinition(result);
     }
     catch (IOException)
     {
     }
 }
Exemple #2
0
        /**
         * Writes the section definition data
         *
         * @return A byte array with the section definition data
         */
        public byte[] WriteSectionDefinition()
        {
            MemoryStream result = new MemoryStream();

            try {
                RtfHeaderFooterGroup header = ConvertHeaderFooter(this.header, HF.RtfHeaderFooter.TYPE_HEADER);
                RtfHeaderFooterGroup footer = ConvertHeaderFooter(this.footer, HF.RtfHeaderFooter.TYPE_FOOTER);
                if (header.HasTitlePage() || footer.HasTitlePage())
                {
                    result.Write(TITLE_PAGE, 0, TITLE_PAGE.Length);
                    header.SetHasTitlePage();
                    footer.SetHasTitlePage();
                }
                if (header.HasFacingPages() || footer.HasFacingPages())
                {
                    result.Write(FACING_PAGES, 0, FACING_PAGES.Length);
                    header.SetHasFacingPages();
                    footer.SetHasFacingPages();
                }
                byte[] t;
                result.Write(t = footer.Write(), 0, t.Length);
                result.Write(t = header.Write(), 0, t.Length);
                result.Write(t = pageSetting.WriteSectionDefinition(), 0, t.Length);
            } catch (IOException) {
            }
            return(result.ToArray());
        }
 /**
  * Writes the section definition data
  * @param result
  */
 public void WriteSectionDefinition(Stream result)
 {
     try {
         RtfHeaderFooterGroup header = ConvertHeaderFooter(this.header, HF.RtfHeaderFooter.TYPE_HEADER);
         RtfHeaderFooterGroup footer = ConvertHeaderFooter(this.footer, HF.RtfHeaderFooter.TYPE_FOOTER);
         if (header.HasTitlePage() || footer.HasTitlePage())
         {
             result.Write(TITLE_PAGE, 0, TITLE_PAGE.Length);
             header.SetHasTitlePage();
             footer.SetHasTitlePage();
         }
         if (header.HasFacingPages() || footer.HasFacingPages())
         {
             result.Write(FACING_PAGES, 0, FACING_PAGES.Length);
             header.SetHasFacingPages();
             footer.SetHasFacingPages();
         }
         footer.WriteContent(result);
         header.WriteContent(result);
         pageSetting.WriteSectionDefinition(result);
     } catch (IOException) {
     }
 }