Hi,
I am trying to add a pdfptable to a itextsharp document. Since the data is large it throws the error "Object reference not set to an instance of an Object".
However it works fine with small data.
please provide a solution for the issue.
Please find the stack trace below:
at iTextSharp.text.pdf.PdfPTable.RowSpanAbove(Int32 currRow, Int32 currCol)
at iTextSharp.text.pdf.PdfPTable.GetRowHeight(Int32 idx, Boolean firsttime)
at iTextSharp.text.pdf.PdfPTable.GetRowHeight(Int32 idx)
at iTextSharp.text.pdf.ColumnText.GoComposite(Boolean simulate)
at iTextSharp.text.pdf.ColumnText.Go(Boolean simulate)
at iTextSharp.text.pdf.PdfPCell.GetMaxHeight()
at iTextSharp.text.pdf.PdfPRow.CalculateHeights()
at iTextSharp.text.pdf.PdfPRow.SplitRow(PdfPTable table, Int32 rowIndex, Single new_height)
at iTextSharp.text.pdf.ColumnText.GoComposite(Boolean simulate)
at iTextSharp.text.pdf.ColumnText.Go(Boolean simulate)
at iTextSharp.text.pdf.ColumnText.Go()
at iTextSharp.text.pdf.PdfDocument.AddPTable(PdfPTable ptable)
at iTextSharp.text.pdf.PdfDocument.Add(IElement element)
at iTextSharp.text.Document.Add(IElement element)
at iTextSharp.text.pdf.PdfPTable.GetRowHeight(Int32 idx, Boolean firsttime)
at iTextSharp.text.pdf.PdfPTable.GetRowHeight(Int32 idx)
at iTextSharp.text.pdf.ColumnText.GoComposite(Boolean simulate)
at iTextSharp.text.pdf.ColumnText.Go(Boolean simulate)
at iTextSharp.text.pdf.PdfPCell.GetMaxHeight()
at iTextSharp.text.pdf.PdfPRow.CalculateHeights()
at iTextSharp.text.pdf.PdfPRow.SplitRow(PdfPTable table, Int32 rowIndex, Single new_height)
at iTextSharp.text.pdf.ColumnText.GoComposite(Boolean simulate)
at iTextSharp.text.pdf.ColumnText.Go(Boolean simulate)
at iTextSharp.text.pdf.ColumnText.Go()
at iTextSharp.text.pdf.PdfDocument.AddPTable(PdfPTable ptable)
at iTextSharp.text.pdf.PdfDocument.Add(IElement element)
at iTextSharp.text.Document.Add(IElement element)
AnjanaPosted Mar 6, 2014, 12:04 AM
I throws the exception when i try to add the pdfptable to the document.
Please find the code below.
if (pdfBodyTable != null && pdfBodyTable.Rows.Count > 0)
{
AgentDoc.Add(pdfBodyTable);
}
It throws the exception in the add method. Pdfbodytable has only 1 row which consist of multiple small tables.
Lakshmanan Sethu SankaranarayanPosted Mar 5, 2014, 8:52 AM