We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Table/row/cell borders not showing as expected (at least on the first row)

Hi! I am upgrading Aspose PDF 6.4 to Aspose PDF 7.9. I am using the classes in the Aspose.Pdf.Generator namespace. I currently have 3 issues (please see attachment for first 2 issues… as we say a picture is worth a 1000 words):


1. I have been having issues with the table, row and cell borders. In the following code, I was expecting all cells to have a green right border and a blue border at the bottom of the first row. With version 6.4, that is exactly what I get but with version 7.9, I am missing the green and blue borders on the first row.

2. Is there a way to specify that the green border does not overlap/step on the red table border. The green cell border also falls outside the table. This behavior has not changed between version 6.4 and 7.9.

3. The NuGet package for version 7.9 is actually installing version 7.8 dll (I installed it on april 17th 2013). I wasted a couple of hours on a table layout which was broken because of a bug with the rowSpan/columnSpan which was fixed in 7.9.

Here is my sample code:
private static void TestRapport()
{
Pdf pdf = new Pdf();
pdf.CompressionLevel = 6;
Section section = new Section(pdf);
pdf.Sections.Add(section);

Table table = new Table();
table.Border = new BorderInfo((int)BorderSide.Box, 0.1f, new Color(“Red”));
table.DefaultCellBorder = new BorderInfo((int)BorderSide.Right, new Color(“Green”));
string widths = “25 50 35 50”;
table.ColumnWidths = widths;

Row row1 = table.Rows.Add();
row1.Border = new BorderInfo((int)BorderSide.All, new Color(“Blue”));
AddCell(row1, “cell1”, 1, 1);
AddCell(row1, “cell2”, 2, 1);
AddCell(row1, “cell3”, 1, 1);

Row row2 = table.Rows.Add();
AddCell(row2, “cell4”, 1, 1);
AddCell(row2, “cell5-6”, 2, 1);
AddCell(row2, “cell7”, 1, 1);
Row row3 = table.Rows.Add();
AddCell(row3, “cell8”, 1, 2);
AddCell(row3, “cell9”, 1, 1);
AddCell(row3, “cell10”, 2, 2);

Row row4 = table.Rows.Add();
AddCell(row4, “cell11”, 1, 1);

section.Paragraphs.Add(table);

string fichierTest = @“d:\RowBorderTests.pdf”;
pdf.Save(fichierTest);
Process.Start(fichierTest);
}

private static Cell AddCell(Row row, string text, int colSpan, int rowSpan, Color couleur = null)
{
Cell cell = row.Cells.Add(text); cell.RowSpan = rowSpan; cell.ColumnsSpan = colSpan;
if (couleur != null)
{
cell.BackgroundColor = couleur;
}
return cell;
}

Thanks,

Jean-François Rouleau

Hi Jean,


Sorry for the inconvenience faced. I’ve observed the table/row/cell border issue and overlapping of cell and table borders. I’ve logged the
issue in our bug tracking system as PDFNEWNET-35173 for further investigation and resolution. I’ve also linked your request to this
issue and you will be notified via this thread as soon as it is resolved.

Moreover, thanks for highlighting NuGet issue. We are looking into to the issue and hopefully will fix it soon.

Please feel free to contact us for
any further assistance.

Best Regards,

Hi Jean,


Thanks for your patience.

I am pleased to share that the issue reported earlier has been resolved and its resolution will be included in upcoming release version of Aspose.Pdf for .NET 8.1.0 which is planned to release within current week. Please try using the following code snippet to generate the correct output.

[C#]

Document doc = new
Document();<o:p></o:p>

Page page = doc.Pages.Add();

// Create a table...

Aspose.Pdf.Table table = new Aspose.Pdf.Table();

table.Border = new Aspose.Pdf.BorderInfo(Aspose.Pdf.BorderSide.Box, 0.1f, Aspose.Pdf.Color.Red);

table.DefaultCellBorder = new Aspose.Pdf.BorderInfo(Aspose.Pdf.BorderSide.Right, Aspose.Pdf.Color.Green);

string widths = "25 50 35 50";

table.ColumnWidths = widths;

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

row1.Border = new Aspose.Pdf.BorderInfo(Aspose.Pdf.BorderSide.All, Aspose.Pdf.Color.Blue);

AddCell(row1, "cell1", 1, 1);

AddCell(row1, "cell2", 2, 1);

AddCell(row1, "cell3", 1, 1);

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

AddCell(row2, "cell4", 1, 1);

AddCell(row2, "cell5-6", 2, 1);

AddCell(row2, "cell7", 1, 1);

Aspose.Pdf.Row row3 = table.Rows.Add();

AddCell(row3, "cell8", 1, 2);

AddCell(row3, "cell9", 1, 1);

AddCell(row3, "cell10", 2, 2);

Aspose.Pdf.Row row4 = table.Rows.Add();

AddCell(row4, "cell11", 1, 1);

page.Paragraphs.Add(table);

doc.Save("c:/pdftest/TableBorderIssue.pdf");

public void AddCell(Aspose.Pdf.Row row, string text, int colSpan, int rowSpan)

{

Aspose.Pdf.Cell cell = row.Cells.Add(text);

cell.RowSpan = rowSpan;

cell.ColSpan = colSpan;

}

The issues you have found earlier (filed as PDFNEWNET-35173) have been fixed in Aspose.Pdf for .NET 8.1.0.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.