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

Free Support Forum - aspose.com

Nested table-alignment change on page break-

Hello I am using following sample code for generating Nested Table. But I am facing one issue that is table extends to more than one page. and set repeating rows count as 1. Alignment of 1st row gets changed. please find attached output pdf for the code.

var table = new Table();

//Nested table column header

var tableHeaderRow = table.Rows.Add();

//Blank Cell

tableHeaderRow.Cells.Add();

// Add nested table columns

var columnHeaderCell = tableHeaderRow.Cells.Add();

var dummyColumnTable = new Table();

dummyColumnTable.Border = new BorderInfo(BorderSide.All, 0.1f);

dummyColumnTable.DefaultCellBorder = new BorderInfo(BorderSide.All, 0.1f);

var dummyaRow1 = dummyColumnTable.Rows.Add();

var dummyColumn1 = dummyaRow1.Cells.Add();

dummyColumn1.ColSpan = 5;

dummyColumn1.Paragraphs.Add(new TextFragment(“Header1”));

var dummyaRow2 = dummyColumnTable.Rows.Add();

var dummyColumn2 = dummyaRow2.Cells.Add();

dummyColumn2.ColSpan = 3;

dummyColumn2.Paragraphs.Add(new TextFragment(“Header11”));

var dummyColumn3 = dummyaRow2.Cells.Add();

dummyColumn3.ColSpan = 2;

dummyColumn3.Paragraphs.Add(new TextFragment(“Header12”));

//for(int i = 0; i
//{

var dummyaRow = dummyColumnTable.Rows.Add();

for (int j = 0; j < 5; j++)

{

var dummyCell = dummyaRow.Cells.Add();

dummyCell.Paragraphs.Add(new TextFragment(“Test[” + j + “]”));

}

//}

dummyColumnTable.ColumnWidths = “40 40 40 40 40”;

columnHeaderCell.Paragraphs.Add(dummyColumnTable);

//Nested table rows

var tableRows = table.Rows.Add();

var tableRowsCell = tableRows.Cells.Add();

tableRowsCell.Margin = new MarginInfo(1.25, 0, 0, 0);

tableRowsCell.ColSpan = 2;

var dummyrowTable = new Table();

dummyrowTable.Border = new BorderInfo(BorderSide.All, 0.1f);

dummyrowTable.DefaultCellBorder = new BorderInfo(BorderSide.All, 0.1f);

for (int i = 0; i < 100; i++)

{

var dummyRow = dummyrowTable.Rows.Add();

for (int j = 0; j < 7; j++)

{

var dummyCell = dummyRow.Cells.Add();

dummyCell.Paragraphs.Add(new TextFragment("-"));

dummyCell.Paragraphs.Add(new TextFragment("-"));

}

}

dummyrowTable.ColumnWidths = “40 40 40 40 40 40 40”;

tableRowsCell.Paragraphs.Add(dummyrowTable); // Adds nested table rows.

table.RepeatingRowsCount = 1;

table.ColumnWidths = (dummyrowTable.GetWidth() - dummyColumnTable.GetWidth()).ToString(CultureInfo.InvariantCulture) + " " + dummyColumnTable.GetWidth().ToString(CultureInfo.InvariantCulture);

//doc.Pages[1].Paragraphs.Add(heading1);

Aspose.Pdf.Document doc = new Aspose.Pdf.Document();

doc.Pages.Add();

doc.Pages[1].Paragraphs.Add(table);

doc.Save(@“H:\NestedTable.pdf”);

Thank you,

Hello Ranjeeta,


I have tested the scenario in our environment and managed to reproduce the issue which you have mentioned. For the sake of correction, I have logged an issue as PDFNET-42740 in our issue tracking system. We will further investigate the issue and keep you updated on the status of its rectification. Please be patient and spare us little time.

We are sorry for the inconvenience.


Best Regards,

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