//--- /// <summary> /// Add to the row all XML elements defined in node. /// Supports: textbox, line,image,textblock,pagenumber and customelement /// /// </summary> /// <param name="row"></param> /// <param name="node"></param> /// <param name="font"></param> private void _buildDrawElement(Row row, XmlNode node, XmlAttributeCollection font) { foreach (XmlNode child in node.ChildNodes) { switch (child.Name) { case "textbox": row.AddDrawElement(BuildTextBox(child, font)); break; case "line": row.AddDrawElement(_buildLine(child, font)); break; case "image": row.AddDrawElement(BuildImage(child, font)); break; case "textblock": row.AddDrawElement(_buildTextBlock(child, font)); break; case "pagenumber": row.AddDrawElement(_buildPageNumber(child, font)); break; case CustomElementConstant: row.AddDrawElement(BuildCustomElement(child, font)); break; } if (child.Name == "font" && child.HasChildNodes) { _buildDrawElement(row, child, child.Attributes); } } }
/// <summary> /// Builds a PDF row. /// </summary> /// <param name="node">node of xml row</param> /// <param name="font"></param> /// <returns></returns> public Row _buildRow(XmlNode node, XmlAttributeCollection font) { Row row = new Row(PageDefinition.Margin_left, PageDefinition.Width - PageDefinition.Margin_right); _buildDrawElement(row, node, font); row.CalculateWidth(); return row; }
/// <summary> /// Add a new row. /// </summary> /// <param name="row"></param> public void AddRow(Row row) { rows.Add(row); height += row.Height; }