/// <summary> /// Add a new table row. /// </summary> /// <param name="tableRow"></param> public void AddTableRow(TableRow tableRow) { tableRows.Add(tableRow); }
private TableRow BuildTableRow(XmlNode tableRowNode, XmlAttributeCollection fontAttrs) { TableRow tableRow = new TableRow(); if (tableRowNode.HasChildNodes) BuildTableRowElement(tableRow, tableRowNode, fontAttrs); return tableRow; }
/// <summary> /// Add a row of pdfpcell to table. /// return True, current page have enought size for that row /// return False, current page not enought size for that row, row will be remove and need to draw on /// next page /// 20130606 :: jaimelopez :: mellorasinxelas to support absolute footer. /// </summary> /// <param name="table"></param> /// <param name="tableRowElement"></param> /// <param name="data"></param> /// <returns></returns> protected bool DrawTableRow( PdfPTable table, TableRow tableRowElement, IDictionary data) { bool enoughSpace = true; PDFDrawItextSharp.PDFDrawItextSharp pdfDraw = (PDFDrawItextSharp.PDFDrawItextSharp)pdfDrawer; foreach (TableCell tableCell in tableRowElement.TableCells) { PdfPCell cell = pdfDraw.CreateTableCell(tableCell.Attributes, data); foreach (DrawElement drawElement in tableCell.DrawElements) { if (drawElement is TextBox) { //iTextSharp.text.Phrase phrase = _pdfDraw.CreatePhrase( // ((PDFTemplate.TextBox)drawElement).GetText(data), drawElement.FontAttributes); Paragraph paragraph = pdfDraw.CreateParagraph(((TextBox)drawElement).GetText(data), drawElement.FontAttributes); paragraph.Alignment = PDFDrawItextSharpHelper.Align(Helper.GetAttributeValue("align", drawElement.Attributes, "Left")); cell.AddElement(paragraph); } else if (drawElement is PDFTemplate.Image) { iTextSharp.text.Image image = pdfDraw.CreateImageFromAttribute(drawElement.Attributes); image.Alignment = PDFDrawItextSharpHelper.Align(Helper.GetAttributeValue("align", drawElement.Attributes, "Left")); cell.AddElement(image); } } table.AddCell(cell); } table.CompleteRow(); //if(table.row //fixme need to check if any row span if (pdfDrawer.isNoMoreY(table.TotalHeight, DocumentGroup.Table)) { enoughSpace = false; table.DeleteLastRow(); } return enoughSpace; }
private void BuildTableRowElement(TableRow tableRow, XmlNode tableRowNode, XmlAttributeCollection fontAttrs) { foreach (XmlNode child in tableRowNode) { switch (child.Name) { case "tablecell": tableRow.AddTableCell(BuildTableCell(child, fontAttrs)); break; } if (child.Name == "font" && child.HasChildNodes) { BuildTableRowElement(tableRow, child, child.Attributes); } } }