Category / Section
How to insert an image in the PdfGrid?
1 min read
You can insert an image into the PdfGrid by using the BackgroundImage property in the Cell style.
You can refer to the following code example to insert an image into the Grid.
C#
//Creates the PdfGrid PdfGrid pdfGrid = new PdfGrid(); //Adds the columns pdfGrid.Columns.Add(); pdfGrid.Columns.Add(); //Adds the row and value to the cell for (int i = 0; i < 10; i++) { PdfGridRow pdfGridRow = pdfGrid.Rows.Add(); pdfGridRow.Cells[0].Value = "Syncfusion"; pdfGridRow.Cells[1].Value = "Software"; } //Applies the image PdfBitmap pBmp = new PdfBitmap(@"..\..\Data\logo.png"); pdfGrid.Rows[0].Cells[0].Style.BackgroundImage = pBmp; pdfGrid.Rows[0].Cells[0].Value = ""; //Draws the Grid pdfGrid.Draw(page, new PointF(0, 0));
Sample Link
http://www.syncfusion.com/downloads/support/directtrac/general/PdfGridSample-2137715442.zip