How to add two images into one table cell?

Hello,

Can you please show me how to add two images and a html tag
into one table cell?

I tried this but got an error message:

Row1C1.Paragraphs.Add(image1 + "
" + image2);

Many thanks in advance for your help.

Hi,

Thank you for considering Aspose.

Here is the code for you.

[C#]

Pdf pdf1 = new Pdf();

//////Create a section in the Pdf instance

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

////Create a Table object

Aspose.Pdf.Table pdfCurrentTable = new Aspose.Pdf.Table(sec1);

Aspose.Pdf.Row row0, row1, row2, row3;

row0 = pdfCurrentTable.Rows.Add();

Aspose.Pdf.Cell cell0, cell1;

cell0 = row0.Cells.Add();

//Create an image object

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

//Set the path of image file

image1.ImageInfo.File = @"E:\AsposeTest\BDR_(2495)_exp_08-06-2007_18h20m09s70ms.doc.003.png";

//Set the type of image using ImageFileType enumeration

image1.ImageInfo.ImageFileType = ImageFileType.Png;

row0.Cells[0].Paragraphs.Add(image1);

string s = "
";

Text t1 = new Text(s);

t1.IsHtmlTagSupported = true;

row0.Cells[0].Paragraphs.Add(t1);

//Create an image object in the section

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

pdfCurrentTable.DefaultCellBorder = new BorderInfo((int)BorderSide.All, 0.1F);

//Set the path of image file

image2.ImageInfo.File = @"E:\AsposeTest\BDR_(2495)_exp_08-06-2007_18h20m09s70ms.doc.003.png";

//Set the type of image using ImageFileType enumeration

image2.ImageInfo.ImageFileType = ImageFileType.Png;

row0.Cells[0].Paragraphs.Add(image2);

cell1 = row0.Cells.Add();

string s2 = "Second Cell";

Text t2 = new Text(s2);

row0.Cells[1].Paragraphs.Add(t2);

sec1.Paragraphs.Add(pdfCurrentTable);

pdf1.Save(@"E:\AsposeTest\TestTable.pdf");

Hope it helps.

Thanks.

Thanks Adeel. It worked.