iTextSharp.text.pdf.PdfPTable.DeleteLastRow C# (CSharp) Метод

DeleteLastRow() публичный Метод

public DeleteLastRow ( ) : bool
Результат bool
        public bool DeleteLastRow()
        {
            return DeleteRow(rows.Count - 1);
        }

Usage Example

Пример #1
0
        /// <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;
        }