/** * Output the content of the <CODE>RtfTable</CODE> to an Stream. * * @param os The <code>Stream</code> that the content of the <code>RtfTable</code> is to be written to * @return true if writing the table succeeded * @throws DocumentException * @throws IOException */ public bool WriteTable(MemoryStream os) { if (!this.writer.WritingHeaderFooter()) { // Added by Benoit WIART <*****@*****.**> // Add a new line before each table os.WriteByte(RtfWriter.escape); os.Write(RtfWriter.paragraph, 0, RtfWriter.paragraph.Length); } int size = rowsList.Count; for (int i = 0; i < size; i++) { RtfRow row = (RtfRow)rowsList[i]; row.WriteRow(os, i, origTable); os.WriteByte((byte)'\n'); } if (!writer.WritingHeaderFooter()) { os.WriteByte(RtfWriter.escape); os.Write(RtfWriter.paragraphDefaults, 0, RtfWriter.paragraphDefaults.Length); os.WriteByte(RtfWriter.escape); os.Write(RtfWriter.paragraph, 0, RtfWriter.paragraph.Length); switch (origTable.Alignment) { case Element.ALIGN_LEFT: os.WriteByte(RtfWriter.escape); os.Write(RtfWriter.alignLeft, 0, RtfWriter.alignLeft.Length); break; case Element.ALIGN_RIGHT: os.WriteByte(RtfWriter.escape); os.Write(RtfWriter.alignRight, 0, RtfWriter.alignRight.Length); break; case Element.ALIGN_CENTER: os.WriteByte(RtfWriter.escape); os.Write(RtfWriter.alignCenter, 0, RtfWriter.alignCenter.Length); break; case Element.ALIGN_JUSTIFIED: case Element.ALIGN_JUSTIFIED_ALL: os.WriteByte(RtfWriter.escape); os.Write(RtfWriter.alignJustify, 0, RtfWriter.alignJustify.Length); break; } } return(true); }