Hi, I'm trying to get several images in a table, but the images shows up randomly, here is part of the code:
Dim imgX As New Aspose.Pdf.Image() imgX.ImageInfo.File = Server.MapPath("../images/") & "test.jpg" imgX.ImageInfo.ImageFileType = ImageFileType.Jpeg for r = 0 to 25 oRow = New Aspose.Pdf.Row(oTbl) oTbl.Rows.Add(oRow) for c = 0 to 3 oCell = New Aspose.Pdf.Cell(oTbl) oRow.Cells.Add(oCell) if c = 0 then oCell.Paragraphs.Add(imgX) else oCellText = New Aspose.Pdf.Text(oSection) oCell.Paragraphs.Add(oCellText) oCellSeg = New Aspose.Pdf.Segment(oCellText) oCellText.Segments.Add(oCellSeg) oCellSeg.Content = "Testing" end if next next
There should be something else then oCell.Paragraphs.Add(imgX), what?
for r = 0 to 25 oRow = New Aspose.Pdf.Row(oTbl) oTbl.Rows.Add(oRow) for c = 0 to 3 oCell = New Aspose.Pdf.Cell(oTbl) oRow.Cells.Add(oCell) if c = 0 then
Dim imgX As New Aspose.Pdf.Image() imgX.ImageInfo.File = Server.MapPath("../images/") & "test.jpg" imgX.ImageInfo.ImageFileType = ImageFileType.Jpeg oCell.Paragraphs.Add(imgX) else oCellText = New Aspose.Pdf.Text(oSection) oCell.Paragraphs.Add(oCellText) oCellSeg = New Aspose.Pdf.Segment(oCellText) oCellText.Segments.Add(oCellSeg) oCellSeg.Content = "Testing" end if next next
The reason of images showing up randomly is that you add the same image object to the cell everytime, eventually, there is only one image in the table. When break the table into another page, a copy of the image is create, that is why each page has only one image.
If you still have some problems, Please let me know.