We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

index exception with syncfusion pdfgrid.draw

I am using pdfgrid.draw and i get following exception.

at System.Collections.Generic.List`1.get_Item(Int32 index)

   at Syncfusion.Pdf.Grid.PdfGridLayouter.DrawRow(PdfGridRow row)

   at Syncfusion.Pdf.Grid.PdfGridLayouter.LayoutOnPage(PdfLayoutParams param)

   at Syncfusion.Pdf.Grid.PdfGridLayouter.LayoutInternal(PdfLayoutParams param)

   at Syncfusion.Pdf.Graphics.ElementLayouter.Layout(PdfLayoutParams param)

   at Syncfusion.Pdf.Grid.PdfGrid.Layout(PdfLayoutParams param)

   at Syncfusion.Pdf.Graphics.PdfLayoutElement.Draw(PdfPage page, RectangleF layoutRectangle, PdfLayoutFormat format)

   at Syncfusion.Pdf.Graphics.PdfLayoutElement.Draw(PdfPage page, Single x, Single y, PdfLayoutFormat format)

   at Syncfusion.Pdf.Graphics.PdfLayoutElement.Draw(PdfPage page, PointF location, PdfLayoutFormat format)

   at Syncfusion.Pdf.Grid.PdfGrid.Draw(PdfPage page, PointF location, PdfGridLayoutFormat format)


during debugging i noticed that if i add dummy rows to pdfgrid before calling pdfgrid.draw then then code works, excpet the pdf has extra rows tacked on to bottom of grid. 


i can create pdf with no issue if i use individual records from my datasource to generate the pdf, but if i use the netire datasource of 35 rows then i run into this issue. 


is there a max pdfgrid.rows beyond which i have to add additional rows?


my pointF is pointF.Empty


4 Replies

JB jb replied to jb March 12, 2015 01:46 AM UTC

I am using pdfgrid.draw and i get following exception.

at System.Collections.Generic.List`1.get_Item(Int32 index)

   at Syncfusion.Pdf.Grid.PdfGridLayouter.DrawRow(PdfGridRow row)

   at Syncfusion.Pdf.Grid.PdfGridLayouter.LayoutOnPage(PdfLayoutParams param)

   at Syncfusion.Pdf.Grid.PdfGridLayouter.LayoutInternal(PdfLayoutParams param)

   at Syncfusion.Pdf.Graphics.ElementLayouter.Layout(PdfLayoutParams param)

   at Syncfusion.Pdf.Grid.PdfGrid.Layout(PdfLayoutParams param)

   at Syncfusion.Pdf.Graphics.PdfLayoutElement.Draw(PdfPage page, RectangleF layoutRectangle, PdfLayoutFormat format)

   at Syncfusion.Pdf.Graphics.PdfLayoutElement.Draw(PdfPage page, Single x, Single y, PdfLayoutFormat format)

   at Syncfusion.Pdf.Graphics.PdfLayoutElement.Draw(PdfPage page, PointF location, PdfLayoutFormat format)

   at Syncfusion.Pdf.Grid.PdfGrid.Draw(PdfPage page, PointF location, PdfGridLayoutFormat format)


during debugging i noticed that if i add dummy rows to pdfgrid before calling pdfgrid.draw then then code works, excpet the pdf has extra rows tacked on to bottom of grid. 


i can create pdf with no issue if i use individual records from my datasource to generate the pdf, but if i use the netire datasource of 35 rows then i run into this issue. 


is there a max pdfgrid.rows beyond which i have to add additional rows?


my pointF is pointF.Empty


I loop though my datatable and for each row i add or dont add to grid. when i add to grid, i add row then add the data. Before the draw method, my pdggrid has 32 rows and that is when it fails. however, if i do add rows before draw then it works. the rows i add have no data, they are just blank rows 

what i noticed is 

if pdfgrid.rows.count < mydatasource.row.count and pdfgrid.rows.count = 32 then failure

------------------------------------------------------

while(pdfgrid.row.count < mydatasource.row.count)
{
   pdfgrid.addrow
}
\.draw

this works


KK Karthik Krishnaraj Syncfusion Team March 12, 2015 06:36 PM UTC

Hi Jb,

Thank you for using syncfusion products,

I am afraid that i couldn't able to reproduce the issue, i have attached a simple sample for which we tried to reproduce the issue, can you please check with these sample and let me know if these helps.

Sample Link:


Thanks,
Karthik



JB jb replied to Karthik Krishnaraj March 13, 2015 02:57 PM UTC

Hi Jb,

Thank you for using syncfusion products,

I am afraid that i couldn't able to reproduce the issue, i have attached a simple sample for which we tried to reproduce the issue, can you please check with these sample and let me know if these helps.

Sample Link:


Thanks,
Karthik


Resolved the issue. Was not sending in the right data and call.  user error. thanks


KK Karthik Krishnaraj Syncfusion Team March 16, 2015 11:17 AM UTC

Hi Jb,

Thank you for your update,
We are happy to hear your problem has been resolved, please let me know if you have any other queries.

Thanks,
Karthik.

Loader.
Live Chat Icon For mobile
Up arrow icon