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);
}
}