/** * Write the beginning of a new <code>Section</code> * * @param sectionElement The <code>Section</code> be written * @param outp The <code>MemoryStream</code> to write to * * @throws IOException * @throws DocumentException */ private void WriteSection(Section sectionElement, MemoryStream outp) { if (sectionElement.Type == Element.CHAPTER) { outp.WriteByte(escape); outp.Write(sectionDefaults, 0, sectionDefaults.Length); WriteSectionDefaults(outp); } if (sectionElement.Title != null) { if (writeTOC) { StringBuilder title = new StringBuilder(); foreach (Chunk ck in sectionElement.Title.Chunks) { title.Append(ck.Content); } Add(new RtfTOCEntry(title.ToString(), sectionElement.Title.Font)); } else { Add(sectionElement.Title); } outp.WriteByte(escape); outp.Write(paragraph, 0, paragraph.Length); } sectionElement.Process(this); if (sectionElement.Type == Element.CHAPTER) { outp.WriteByte(escape); outp.Write(section, 0, section.Length); } if (sectionElement.Type == Element.SECTION) { outp.WriteByte(escape); outp.Write(paragraph, 0, paragraph.Length); } }