Inserting Image in a Cell


Is there a way to insert an image in to a specific table cell?

Let me know.




Here is a sample for you.


Aspose.Pdf.Pdf pdf1 = new Pdf();

Aspose.Pdf.Section sec1 = pdf1.Sections.Add();

Aspose.Pdf.Table table1 = new Aspose.Pdf.Table();
table1.ColumnWidths = "70 2cm";

Aspose.Pdf.Row row1 = table1.Rows.Add();

Aspose.Pdf.Cell cell1Row1 = row1.Cells.Add("ColumnsSpan = 2");
cell1Row1.ColumnsSpan = 2;
cell1Row1.Border = new BorderInfo((int)BorderSide.All,0.5F);

Aspose.Pdf.Row row2 = table1.Rows.Add();

Aspose.Pdf.Cell cell1Row2 = row2.Cells.Add("cell1");
cell1Row2.Border = new BorderInfo((int)BorderSide.All,0.5F);

Aspose.Pdf.Cell cell2Row2 = row2.Cells.Add("cell2");

Aspose.Pdf.Image image1 = new Aspose.Pdf.Image();

//Add image object into the Paragraphs specified cell.


//Set the path of image file

image1.ImageInfo.File = "76_57749.jpg";

//Set the type of image using ImageFileType enumeration

image1.ImageInfo.ImageFileType = ImageFileType.Jpeg;

cell2Row2.Border = new BorderInfo((int)BorderSide.All,0.5F,new Aspose.Pdf.Color("Red"));