Tables and images question

I have created an
asposePDF, adding a 2 column table to it. I added two rows to the table
and the goal is a 2x2 grid with 4 images to a page. I am only seeing 2
of the 4 images, and it appears the problem is how I am referencing the
table cells, as images in column zero always show up. Here is a
fragment of what I am doing

dim aspimg1 as new Aspose.PDF.Image
dim aspimg2 as new Aspose.PDF.Image

dim aspimg3 as new Aspose.PDF.Image

dim aspimg4 as new Aspose.PDF.Image

… assign filenames, width, etc using ImageInfo - skipped here for brevity

Dim row as Row = mytable.Rows.Add()

Dim row2 as Row = mytable.Rows.Add()

row1.Cells(0).Paragraphs.Add(aspimg1)

row1.Cells(1).Paragraphs.Add(aspimg2)
row2.Cells(0).Paragraphs.Add(aspimg1)

row2.Cells(1).Paragraphs.Add(aspimg2)

Using this approach, only column zero has images. Column 1 is empty. Can you let me know what I am doing wrong here? Thanks.

Hi,

Thank you for considering Aspose.

In my test, it works fine. I used following code and the resultant Pdf is attached. If you still got errors, then please share your image definition code as well.

Pdf pdf = new Pdf();
Aspose.Pdf.Section sec = pdf.Sections.Add();
Aspose.Pdf.Table tabl = new Aspose.Pdf.Table();
Aspose.Pdf.Row row1 = tabl.Rows.Add();
Aspose.Pdf.Row row2 = tabl.Rows.Add();
tabl.DefaultCellBorder = new BorderInfo((int)BorderSide.All, 0.1F);
Aspose.Pdf.Cell R1C1 = row1.Cells.Add();
Aspose.Pdf.Cell R1C2 = row1.Cells.Add();
Aspose.Pdf.Cell R2C1 = row2.Cells.Add();
Aspose.Pdf.Cell R2C2 = row2.Cells.Add();
Aspose.Pdf.Image image1 = new Aspose.Pdf.Image();
image1.ImageInfo.File = "D:/AsposeTest/Sapna/PortraitBackgroundNoColumn.GIF";
image1.ImageInfo.ImageFileType = ImageFileType.Gif;
Aspose.Pdf.Image image2= new Aspose.Pdf.Image();
image2.ImageInfo.File = "D:/AsposeTest/Sapna/IOP.jpg";
image2.ImageInfo.ImageFileType = ImageFileType.Jpeg;
R1C1.Paragraphs.Add(image1);
R1C2.Paragraphs.Add(image2);
R2C1.Paragraphs.Add(image1);
R2C2.Paragraphs.Add(image2);
sec.Paragraphs.Add(tabl);
pdf.Save("D:/AsposeTest/ImgeTable.pdf");

Thanks.

Adeel Ahmad
Support Developer
Aspose Changsha Team