Fixed number of cells in a row issue

Hi support,

If a row within a table has a different number of cells than the cells number in the first row, then the table in the output does not look as expected.

Here is a sample code:
Pdf pdf = new Pdf();
//add a section
Section sec1 = pdf.getSections().add();
Table table = new Table(sec1);

GraphInfo gr = new GraphInfo();
gr.setLineStyle(LineStyleType.Solid);
gr.setLineWidth(1);

//add a row
Row row1 = new Row(table);
table.getRows().add(row1);
Cell cell11 = row1.getCells().add("cell11");
cell11.getBorder().setAll(gr);
Cell cell12 = row1.getCells().add("cell12");
cell12.getBorder().setAll(gr);

//add another row
Row row2 = new Row(table);
table.getRows().add(row2);
Cell cell21 = row2.getCells().add("cell21");
cell21.getBorder().setAll(gr);

<br>

//add another row
Row row3 = new Row(table);
table.getRows().add(row3);
Cell cell31 = row3.getCells().add("cell31");
cell31.getBorder().setAll(gr);

//add table to sec1
sec1.getParagraphs().add(table);
pdf.save(new FileOutputStream(new File("C:/Temp/TableRowBug.pdf")));

As you can note in the output, the second row has two cells, instead of one, as the code specifies.

Best regards,
Milan

Hello Milan,

I have tested the issue and I’m able to reproduce the same problem. I have logged it in our issue tracking system as PDFJAVA-6021. We will investigate this issue in detail and will keep you updated on the status of a correction.

Hi support,

Is there any update on this issue ?

Best regards,
Milan

Hello <?xml:namespace prefix = st1 ns = "urn:schemas-microsoft-com:office:smarttags" />Milan,

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

I have contacted the development team and soon you will be updated the status of correction for this issue. Your patience in this regard is highly appreciated.

Hi milan,

The table in the output does not look as expected is because you have to setColumnSpan() manually. In your code, it’s better to add the following code:

cell21.setColumnSpan(2);

cell31.setColumnSpan(2);

Thank you for using our product.

Hi Sandy.Zhang,

In word&html you can draw tables with different number of cells in it’s rows, and without spaning cells. Is this or shall be possible in aspose.pdf for java ?

Regards,
Milan

Hello <?xml:namespace prefix = st1 ns = "urn:schemas-microsoft-com:office:smarttags" />Milan,

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Could you please little elaborate your requirement. It would be more convenient if you share some image file, showing your requirement.

Hi milan,

In your post, you said “In word&html you can draw tables with different number of cells in it's rows, and without spaning cells”. I think in “word&html” you don’t have to set the column span is because the system handle it automatically.

In your previous post, the situation is simple, so the product can handle it automatically. But when the situation becomes complex, it’s hard to find a general solution to handle different situation. Maybe we will handle the column span automatically in the feature release, but I don’t know when we can provide that function.

Thank you for using our product.

The issues you have found earlier (filed as 6021) have been fixed in this update.

The issues you have found earlier (filed as ) have been fixed in this update. This message was posted using BugNotificationTool from Downloads module by MuzammilKhan