Row represent a row within a table. If the row is part of a table which is used in a text document, then Cell merging is possible.
Inheritance: IContent, IHtml
		/// <summary>
		/// create the row header of the data table of the chart
		/// </summary>
		/// <param name="table"></param>
		/// <returns></returns>
		private RowHeader CreateRowHeader(Table table)
		{
			RowHeader   rowheader = new RowHeader (table);
			int startColumnIndex = m_tableData.startcell .columnIndex ;
			int endColumnIndex   = m_tableData.endcell .columnIndex ;
			Row  row              = new Row (table);
			Cell cell             = this.CreateNullStringCell (table);
			row.Cells .Add (cell);
			
			for(int i=startColumnIndex; i<=endColumnIndex; i++)
			{
				Cell  tempCell        = new Cell (table.Document);
				tempCell.OfficeValueType ="string";
				Paragraph   paragraph = new Paragraph (m_document);
				string  content       =((char)('A'+i-1)).ToString ()+"ĮŠ";
				paragraph.TextContent .Add (new SimpleText (m_document ,content));
				tempCell.Content .Add (paragraph);
				row.Cells .Add (tempCell);
	
			}
	
			rowheader.RowCollection .Add (row);
	
			return rowheader;
		}
		/// <summary>
		/// Creates the text document table.
		/// </summary>
		/// <param name="document">The document.</param>
		/// <param name="tableName">Name of the table.</param>
		/// <param name="styleName">Name of the style.</param>
		/// <param name="rows">The rows.</param>
		/// <param name="columns">The columns.</param>
		/// <param name="width">The width.</param>
		/// <param name="useTableRowHeader">if set to <c>true</c> [use table row header].</param>
		/// <param name="useBorder">The useBorder.</param>
		/// <returns></returns>
		public static Table CreateTextDocumentTable(
			AODL.Document.TextDocuments.TextDocument document, 
			string tableName, 
			string styleName, 
			int rows, 
			int columns, 
			double width, 
			bool useTableRowHeader, 
			bool useBorder)
		{
			string tableCnt							= document.DocumentMetadata.TableCount.ToString();
			Table table								= new Table(document, tableName, styleName);
			table.TableStyle.TableProperties.Width	= width.ToString().Replace(",",".")+"cm";

			for(int i=0; i<columns; i++)
			{
				Column column						= new Column(table, "co"+tableCnt+i.ToString());
				column.ColumnStyle.ColumnProperties.Width = GetColumnCellWidth(columns, width);
				table.ColumnCollection.Add(column);
			}

			if (useTableRowHeader)
			{
				rows--;
				RowHeader rowHeader					= new RowHeader(table);
				Row row								= new Row(table, "roh1"+tableCnt);
				for(int i=0; i<columns; i++)
				{
					Cell cell						= new Cell(table.Document, "rohce"+tableCnt+i.ToString());
					if (useBorder)
						cell.CellStyle.CellProperties.Border = Border.NormalSolid;
					row.Cells.Add(cell);
				}
				rowHeader.RowCollection.Add(row);
				table.RowHeader						= rowHeader;
			}

			for(int ir=0; ir<rows; ir++)
			{
				Row row								= new Row(table, "ro"+tableCnt+ir.ToString());
				
				for(int ic=0; ic<columns; ic++)
				{
					Cell cell						= new Cell(table.Document, "ce"+tableCnt+ir.ToString()+ic.ToString());
					if (useBorder)
						cell.CellStyle.CellProperties.Border = Border.NormalSolid;
					row.Cells.Add(cell);
				}

				table.Rows.Add(row);
			}

			return table;
		}
		public void CloneTable()
		{
			TextDocument docuemnt = new TextDocument();
			docuemnt.New();
			Table table = new Table(docuemnt, "table name", "table style");
			
			int numberOfColumns = 10;
			int numberOfRows = 10;
			
			// prepare data
			// add columns
			for (int i = 0; i < numberOfColumns; i++)
			{
				table.ColumnCollection.Add(new Column(table, "style name " + i));
			}
			
			Row row = null;
			// Add rows
			for (int i = 0; i < 2; i++)
			{
				row = new Row(table);
				for (int i1 = 0; i1 < numberOfColumns; i1++)
				{
					Paragraph par = ParagraphBuilder.CreateStandardTextParagraph(docuemnt);
					par.TextContent.AddRange(TextBuilder.BuildTextCollection(docuemnt, (i * numberOfColumns).ToString() + i1));
					row.Cells.Add(new Cell(table.Document, "cell style " + i));
					//row.Cells.Add(new Cell(table.Document));
					row.Cells[i1].Content.Add(par);
					
				}
				table.Rows.Insert(0, row);
			}
			
			
			// clone many rows
			row = table.Rows[0];
			using (IPerformanceCounter counter = new PerformanceCounter())
			{
				for (int i = 0; i < numberOfRows; i++)
				{
					Row newRow = new Row(table, row.StyleName);
					foreach (Cell rowCell in row.Cells)
					{
						Cell cell = new ContentMocker().CloneAny(rowCell) as Cell;
						
						newRow.Cells.Add(cell);
					}
				}
				
				Console.WriteLine(string.Format(
					"Test executed in {0} seconds", counter.GetSeconds()));
			}
		}
		/// <summary>
		/// Creates the table row.
		/// </summary>
		/// <param name="node">The node.</param>
		/// <returns></returns>
		private Row CreateTableRow(XmlNode node)
		{
			try
			{
				//Create a new Row
				Row row						= new Row(this._document, node);
				ContentCollection iColl	= new ContentCollection();
				//Recieve RowStyle
				IStyle rowStyle				= this._document.Styles.GetStyleByName(row.StyleName);

				if (rowStyle != null)
					row.Style				= rowStyle;
				//No need for a warning

				//Create the cells
				foreach(XmlNode nodeChild in row.Node.ChildNodes)
				{
					// Phil Jollans 24-March-2008
					// Handle the attribute table:number-columns-repeated on cell nodes,
					// by inserting multiple nodes. CreateContent clones the nodes so this
					// seems fairly safe.
					int     iRepeatCount = 1;
					XmlNode xn           = nodeChild.SelectSingleNode ( "@table:number-columns-repeated", this._document.NamespaceManager );
					if ( xn != null )
					{
						iRepeatCount = int.Parse ( xn.InnerText );
						
						// Inetrnally, the node is no longer repeated, so it seems correct
						// to remove the the attribute table:number-columns-repeated.
						nodeChild.Attributes.RemoveNamedItem ( xn.Name ) ;
					}
					
					for ( int i = 0 ; i < iRepeatCount ; i++ )
					{
						IContent iContent		= this.CreateContent(nodeChild);

						if (iContent != null)
						{
							//iColl.Add(iContent);
							AddToCollection(iContent, iColl);
						}
						else
						{
							this.OnWarning(new AODLWarning("Couldn't create IContent from a table row.", nodeChild));
						}
					}
				}

				row.Node.InnerXml			= "";

				foreach(IContent iContent in iColl)
				{
					if (iContent is Cell)
					{
						((Cell)iContent).Row		= row;
						row.Cells.Add(iContent as Cell);
					}
					else if (iContent is CellSpan)
					{
						((CellSpan)iContent).Row	= row;
						row.CellSpanCollection.Add(iContent as CellSpan);
					}
					else
					{
						this.OnWarning(new AODLWarning("Couldn't create IContent from a row node. Content is unknown table row content!", iContent.Node));
					}
				}

				return row;
			}
			catch(Exception ex)
			{
				throw new AODLException("Exception while trying to create a Table Row.", ex);
			}
		}
		/// <summary>
		/// Gets the row as HTML.
		/// </summary>
		/// <param name="row">The row.</param>
		/// <returns></returns>
		public string GetRowAsHtml(Row row)
		{
			string html					= "<tr>\n";

			try
			{
				if (row != null)
				{
					if (row.Cells != null)
					{
						foreach(Cell cell in row.Cells)
							html		+= this.GetCellAsHtml(cell);
					}
				}
			}
			catch(Exception ex)
			{
				throw new AODLException("Exception while trying to build a HTML string from a Row object.", ex);
			}

			if (!html.Equals("<tr>\n"))
				html				+= "</tr>\n";
			else
				html				= "";

			return html;
		}
Example #6
0
        /// <summary>
        /// After a row size changed all rows before the changed row
        /// maybe need to be resized. This also belongs to the columns.
        /// </summary>
        /// <param name="rowNumber">The row number.</param>
        /// <param name="cellCount">The cell count.</param>
        private void Row_OnRowChanged( Row sender, int rowNumber, int cellCount)
        {
            if ( sender.Table != this )
                return;

            if(this.ColumnCollection.Count <= cellCount)
            {
                for(int i=0; i <= cellCount-this.ColumnCollection.Count; i++)
                    this.ColumnCollection.Add(new Column(this, "col"+this.ColumnCollection.Count.ToString()+i.ToString()));
            }

            for(int i=0; i<rowNumber; i++)
            {
                if(this.RowCollection[i].CellCollection.Count < cellCount)
                {
                    for(int ii=cellCount-this.RowCollection[i].CellCollection.Count; ii<cellCount; ii++);
                        this.RowCollection[i].CellCollection.Add(new Cell(this));
                }
            }
        }
Example #7
0
        /// <summary>
        /// Inserts the cell at the specified position. Both indexes are 1-based indexes!
        /// The RowCollection, the rows CellCollection and the ColumnCollection
        /// will be resized automatically.
        /// </summary>
        /// <param name="rowIndex">Index of the row.</param>
        /// <param name="columnIndex">Index of the column.</param>
        /// <param name="cell">The cell.</param>
        public void InsertCellAt(int rowIndex, int columnIndex, Cell cell)
        {
            if(this.RowCollection.Count <= rowIndex)
            {
                for(int i=0; i < rowIndex-this.RowCollection.Count; i++)
                    this.RowCollection.Add(new Row(this, "row"+this.RowCollection.Count.ToString()+i.ToString()));

                this.RowCollection[rowIndex-1].InsertCellAt(columnIndex-1, cell);
                cell.Row				= this.RowCollection[rowIndex-1];
            }
            else if(this.RowCollection.Count+1 == rowIndex)
            {
                Row row					= new Row(this, this.RowCollection[this.RowCollection.Count-1].StyleName);
                row.InsertCellAt(columnIndex-1, cell);
                cell.Row				= row;
                this.RowCollection.Add(row);
            }
            else
            {
                this.RowCollection[rowIndex-1].InsertCellAt(columnIndex-1, cell);
                cell.Row				= this.RowCollection[rowIndex-1];
            }
        }
Example #8
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CellSpan"/> class.
 /// The CellSpan class is only usable in TextDocuments.
 /// </summary>
 /// <param name="row">The row.</param>
 /// <param name="document">The document.</param>
 public CellSpan(Row row, IDocument document)
 {
     this.Document	= document;
     this.NewXmlNode();
 }
		private void NoLabels()
		{
			RowHeader   rowheader = rowheader = CreateRowHeader(table);
			table.RowHeader         = rowheader;
	
			for (int j=startRowIndex;j<=endRowIndex; j++)
			{
				Row  tempRow     = new Row (table);
				tempRow.Cells .Add (CreateRowSerialCell(table,j));
				
				for (int k = startColumnIndex; k <= endColumnIndex; k++)
				{
	
					Cell cell = m_tableData.table .Rows [j-1].Cells[k-1];
					int  cellRepeated =0;
					string cellRepeating = cell.ColumnRepeating;
					
					if (cellRepeating!=null)
						cellRepeated = Int32.Parse (cell.ColumnRepeating);
	
					if (cellRepeated >1)
					{
						for(int m=0; m<cellRepeated-1; m++)
						{
							tempRow.Cells .Add (cell);
							j++;
						}
					}
	
					tempRow.Cells .Add (cell);
				}
	
				table.Rows .Add (tempRow);
	
			}
		}
Example #10
0
        /// <summary>
        /// Gets the row as HTML.
        /// </summary>
        /// <param name="row">The row.</param>
        /// <returns></returns>
        public string GetRowAsHtml(Row row)
        {
            string html					= "<tr>\n";

            try
            {
                if(row != null)
                {
                    if(row.CellCollection != null)
                    {
                        foreach(Cell cell in row.CellCollection)
                            html		+= this.GetCellAsHtml(cell);
                    }
                }
            }
            catch(Exception ex)
            {
                AODLException exception		= new AODLException("Exception while trying to build a HTML string from a Row object.");
                exception.InMethod			= AODLException.GetExceptionSourceInfo(new StackFrame(1, true));
                exception.OriginalException	= ex;

                throw exception;
            }

            if(!html.Equals("<tr>\n"))
                html				+= "</tr>\n";
            else
                html				= "";

            return html;
        }
		/// <summary>
		/// Creates the tables.
		/// </summary>
		/// <param name="lines">The lines.</param>
		private void CreateTables(ArrayList lines)
		{
			string unicodeDelimiter				= "\u00BF"; // turned question mark

			if (lines != null)
			{
				Table table						= TableBuilder.CreateSpreadsheetTable(
					(SpreadsheetDocument)this._document, "Table1", "table1");
				//First line must specify the used delimiter
				string delimiter				= lines[0] as string;
				lines.RemoveAt(0);

				try
				{
					//Perform lines
					foreach(string line in lines)
					{
						string lineContent			= line.Replace(delimiter, unicodeDelimiter);
						string[] cellContents		= lineContent.Split(unicodeDelimiter.ToCharArray());
						Row row						= new Row(table);
						foreach(string cellContent in cellContents)
						{
							Cell cell				= new Cell(table.Document);
							Paragraph paragraph		= ParagraphBuilder.CreateSpreadsheetParagraph(this._document);
							paragraph.TextContent.Add(new SimpleText(this._document, cellContent));
							cell.Content.Add(paragraph);
							row.InsertCellAt(row.Cells.Count, cell);
						}
						table.Rows.Add(row);
					}
				}
				catch(Exception ex)
				{
					throw new AODLException("Error while proccessing the csv file.", ex);
				}

				this._document.Content.Add(table);
			}
		}
		/// <summary>
		/// Writes the billing items.
		/// </summary>
		/// <param name="billingDoc">The billing doc.</param>
		private void WriteBillingItems(TextDocument billingDoc)
		{
			if (billingDoc != null)
			{
				foreach(IContent content in billingDoc.Content)
				{
					if (content is Table)
					{
						Table itemTable = (Table)content;
						double priceTotal = 0;
						int r = 0;
						string lastCellStyleName = "";
						foreach(DataRow dr in this._tblItems.Rows)
						{
							Row itemRow = new Row(itemTable);
							int c = 0;
							foreach(object obj in dr.ItemArray)
							{
								lastCellStyleName = "c" + r.ToString() + c.ToString();
								Cell cell = new Cell(itemTable.Document, lastCellStyleName);
								((CellStyle)cell.Style).CellProperties.Padding = "0.2cm";
								((CellStyle)cell.Style).CellProperties.BorderBottom = "0.002cm solid #000000";
								Paragraph p = ParagraphBuilder.CreateParagraphWithCustomStyle(billingDoc, "p" + r.ToString() + c.ToString());
								ParagraphProperties pp = ((ParagraphStyle)p.Style).ParagraphProperties;
								if (pp != null)
								{
									if (c == 1)
										pp.Alignment = TextAlignments.center.ToString();
									if (c > 1)
										pp.Alignment = TextAlignments.end.ToString();
								}
								TextProperties tp = ((ParagraphStyle)p.Style).TextProperties;
								if (tp != null)
								{
									tp.Bold = "bold";
									tp.FontName = FontFamilies.Arial;
									tp.FontSize = "11pt";
									if (c < 2)
										tp.Italic = "italic";
								}
								if (c == 4)
									priceTotal += Double.Parse(obj.ToString());
								p.TextContent.Add(new SimpleText(billingDoc, obj.ToString()));
								cell.Content.Add(p);
								itemRow.Cells.Add(cell);
								c++;
							}
							itemTable.Rows.Add(itemRow);
							r++;
						}

						Row priceTotalRow = new Row(itemTable);						
						for(int i=0; i < 4; i++)
							priceTotalRow.Cells.Add(new Cell(itemTable.Document));

						Cell cell1 = new Cell(itemTable.Document, lastCellStyleName);
						Paragraph p1 = ParagraphBuilder.CreateParagraphWithCustomStyle(billingDoc, "ppricetotal");
						((ParagraphStyle)p1.Style).ParagraphProperties.Alignment = TextAlignments.end.ToString();
						((ParagraphStyle)p1.Style).TextProperties.Bold = "bold";
						((ParagraphStyle)p1.Style).TextProperties.FontSize = "11pt";
						((ParagraphStyle)p1.Style).TextProperties.FontName = FontFamilies.Arial;
						p1.TextContent.Add(new SimpleText(billingDoc, priceTotal.ToString()));
						cell1.Content.Add(p1);
						priceTotalRow.Cells.Add(cell1);
						itemTable.Rows.Add(priceTotalRow);
					}					
				}
			}
		}
Example #13
0
		private Row CloneRow(Row row, Table table)
		{
			Row newRow = new Row(table, row.StyleName);
			foreach (Cell cell in row.Cells)
			{
				newRow.Cells.Add(CloneCell(cell));
			}
			return row;
		}
Example #14
0
		public int RowIndex(Table table, Row row)
		{
			IList Rows = table.Rows as IList;
			return Rows.IndexOf(row);
		}
Example #15
0
		/// <summary>
		/// Creates the text document table.
		/// </summary>
		/// <param name="document">The document.</param>
		/// <param name="tableName">Name of the table.</param>
		/// <param name="styleName">Name of the style.</param>
		/// <param name="rows">The rows.</param>
		/// <param name="columns">The columns.</param>
		/// <param name="width">The width.</param>
		/// <param name="useTableRowHeader">if set to <c>true</c> [use table row header].</param>
		/// <param name="useBorder">The useBorder.</param>
		/// <returns></returns>
		private Table CreateTextDocumentTable(
			AODL.Document.TextDocuments.TextDocument document,
			string tableName,
			string styleName,
			int rows,
			int columns,
			double width,
			Table originalTable)
		{
			string tableCnt							= document.DocumentMetadata.TableCount.ToString();
			Table table								= new Table(document, tableName, styleName);
			table.TableStyle.TableProperties.Width	= width.ToString().Replace(",",".")+"cm";

			for(int i=0; i < columns; i++)
			{
				Column column						= new Column(table, originalTable.ColumnCollection[i].StyleName);
				//column.ColumnStyle.ColumnProperties.Width = GetColumnCellWidth(columns, width);
				table.ColumnCollection.Add(column);
			}

			for(int ir=0; ir < rows; ir++)
			{
				Row row								= new Row(table, originalTable.Rows[ir].StyleName);
				
				for(int ic=0; ic < columns; ic++)
				{
					Cell cell						= new Cell(table.Document, originalTable.Rows[ir].Cells[ic].StyleName);
					//if (useBorder)
					//	cell.CellStyle.CellProperties.Border = Border.NormalSolid;
					row.Cells.Add(cell);
				}

				table.Rows.Add(row);
			}

			return table;
		}
		private void BothHasLabels()
		{
			Row    row  = new Row (table);
			Cell   cell = new Cell (table.Document);
			Paragraph  paragraph  = new Paragraph (m_document );
			cell.Content .Add (paragraph);
			row.Cells .Add (cell);
	
			RowHeader   rowheader = new RowHeader (table);
			
			for(int i=startColumnIndex; i<endColumnIndex ; i++)
			{
				Cell cellTemp = m_tableData.table .Rows [startRowIndex-1].Cells[i];
				
				string cellRepeating = cellTemp.ColumnRepeating ;
				
				int  cellRepeated=0;
	
				if (cellRepeating!=null)
					cellRepeated= Int32.Parse (cellTemp.ColumnRepeating);
	
				if (cellRepeated >1)
				{
					for(int j=0; j<cellRepeated-1; j++)
					{
						row.Cells .Add (cellTemp);
						i++;
					}
				}
				
				row.Cells .Add (cellTemp);
	
			}
			
			rowheader.RowCollection .Add (row);
			
			table.RowHeader =rowheader;
	
	
			for(int i=startRowIndex; i<endRowIndex; i++)
				
			{
				Row tempRow = new Row (table);
				for(int j=startColumnIndex-1;j<endColumnIndex;j++)
				{
					Cell  cellTemp = m_tableData.table .Rows [i].Cells [j];
					string cellRepeating = cellTemp.ColumnRepeating;
					int   cellRepeated =0;
					
					if (cellRepeating!=null)
						cellRepeated= Int32.Parse (cellTemp.ColumnRepeating );
	
					if (cellRepeated>1)
						
					{
						for(int m=0; m<cellRepeated-1; m++)
						{
							tempRow.Cells .Add (cellTemp);
							i++;
						}
					}
	
					tempRow.Cells .Add (cellTemp);
				}
				
				table.Rows .Add (tempRow);
			}
		}
		private void FirstLineLabels()
		{
			RowHeader   rowHeader = new RowHeader (table);
			Row         row       = new Row (table);
			Cell        cell      = CreateNullStringCell(table);
			row.Cells .Add (cell);
			
			for(int i=startColumnIndex; i<=endColumnIndex;i++)
			{
				Cell cellTemp = m_tableData.table .Rows [startRowIndex-1].Cells[i-1];
				int  cellRepeated =0;
				string cellRepeating = cellTemp.ColumnRepeating ;
				
				if (cellRepeating!=null)
					cellRepeated = Int32.Parse (cellTemp.ColumnRepeating);
				
				if (cellRepeated >1)
				{
					for(int j=0; j<cellRepeated-1; j++)
					{
						row.Cells .Add (cellTemp);
						i++;
					}
				}
	
				row.Cells .Add (cellTemp);
	
	
			}
			
			rowHeader.RowCollection .Add (row);
			table.RowHeader = rowHeader;
	
			for(int j=startRowIndex;j<=endRowIndex; j++)
			{
				Row  tempRow     = new Row (table);
				tempRow.Cells .Add (CreateRowSerialCell(table,j+1));
				
				for(int k=startColumnIndex;k<endColumnIndex; k++)
				{
					Cell cellTemp = m_tableData.table .Rows [j].Cells[k];
					int  cellRepeated =0;
					string cellRepeating = cellTemp.ColumnRepeating;
	
					if (cellRepeating!=null)
						cellRepeated=Int32.Parse (cellTemp.ColumnRepeating);
	
					if (cellRepeated >1)
					{
						for(int m=0; m<cellRepeated-1; m++)
						{
							row.Cells .Add (cellTemp);
							j++;
						}
					}
	
					tempRow.Cells .Add (cellTemp);
	
				}
	
				table.Rows .Add (tempRow);
	
			}
		}
		public void CreateEmptyTable()
		{
			// as of 2008-12-28 this tests runs:
			// 14 seconds with AMD athlon 64 X2 machine,
			
			TextDocument docuemnt = new TextDocument();
			docuemnt.New();
			Table table = new Table(docuemnt, "table name", "table style");
			
			int numberOfColumns = 100;
			int numberOfRows = 10000;
			using (IPerformanceCounter counter = new PerformanceCounter())
			{
				// add columns
				for (int i = 0; i < numberOfColumns; i++)
				{
					table.ColumnCollection.Add(new Column(table, "style name"));
				}
				
				// Add rows
				for (int i = 0; i < numberOfRows; i++)
				{
					Row row = new Row(table);
					for (int i1 = 0; i1 < numberOfColumns; i1++)
					{
						row.Cells.Add(new Cell(table.Document));
					}
					table.Rows.Insert(0, row);
				}
				
				Console.WriteLine(string.Format(
					"Test executed in {0} seconds", counter.GetSeconds()));
			}
		}
        /// <summary>
        /// Creates the table row.
        /// </summary>
        /// <param name="node">The node.</param>
        /// <returns></returns>
        private Row CreateTableRow(XmlNode node)
        {
            try
            {
                //Create a new Row
                Row row						= new Row(this._document, node);
                IContentCollection iColl	= new IContentCollection();
                //Recieve RowStyle
                IStyle rowStyle				= this._document.Styles.GetStyleByName(row.StyleName);

                if(rowStyle != null)
                    row.Style				= rowStyle;
                //No need for a warning

                //Create the cells
                foreach(XmlNode nodeChild in row.Node.ChildNodes)
                {
                    IContent iContent		= this.CreateContent(nodeChild);

                    if(iContent != null)
                    {
                        iColl.Add(iContent);
                    }
                    else
                    {
                        if(this.OnWarning != null)
                        {
                            AODLWarning warning			= new AODLWarning("Couldn't create IContent from a table row.");
                            warning.InMethod			= AODLException.GetExceptionSourceInfo(new StackFrame(1, true));
                            warning.Node				= nodeChild;
                            this.OnWarning(warning);
                        }
                    }
                }

                row.Node.InnerXml			= "";

                foreach(IContent iContent in iColl)
                {
                    if(iContent is Cell)
                    {
                        ((Cell)iContent).Row		= row;
                        row.CellCollection.Add(iContent as Cell);
                    }
                    else if(iContent is CellSpan)
                    {
                        ((CellSpan)iContent).Row	= row;
                        row.CellSpanCollection.Add(iContent as CellSpan);
                    }
                    else
                    {
                        if(this.OnWarning != null)
                        {
                            AODLWarning warning			= new AODLWarning("Couldn't create IContent from a row node. Content is unknown table row content!");
                            warning.InMethod			= AODLException.GetExceptionSourceInfo(new StackFrame(1, true));
                            warning.Node				= iContent.Node;
                            this.OnWarning(warning);
                        }
                    }
                }

                return row;
            }
            catch(Exception ex)
            {
                AODLException exception		= new AODLException("Exception while trying to create a Table Row.");
                exception.InMethod			= AODLException.GetExceptionSourceInfo(new StackFrame(1, true));
                exception.Node				= node;
                exception.OriginalException	= ex;

                throw exception;
            }
        }
        private void WriteTable(IMultipleRowsProducer rp, Table table, IGenerationContext context)
        {
            DataRow[] rows = rp.GetValue(context).ToArray();
            if (rows.Length > 0)
            {
                DataTable ptab = rows.First().Table;

                for (int iCol = 0; iCol < ptab.Columns.Count; iCol++)
                {
                    table.ColumnCollection.Add(new Column(table, string.Empty));
                }

                for (int iRow = -1; iRow < rows.Length; iRow++)
                {
                    Row row = new Row(table);
                    table.RowCollection.Add(row);

                    for (int iCol = 0; iCol < ptab.Columns.Count; iCol++)
                    {
                        Cell cell = new Cell(table);
                        object value = (iRow == -1) ? ptab.Columns[iCol].ColumnName : rows[iRow][iCol];

                        CreateAddSimpleText(table.Document, cell.Content, value);

                        row.CellCollection.Add(cell);
                    }
                }
            }
        }