Split row on two pages

Hi there,
We have a long row that row spans over several rows. If one page is full the next underlying row will be shown on the next page, but the content of the long row - the first columns - will only be shown on the last page of the long row.

Example out put:
image.png (33.9 KB)

Example Code:
AMG ASPOSE PDF Example.docx (14.7 KB)

@walterSPIRIT21

Could you please share your expected output PDF file here for our reference? We will then provide you more information on it.

@tahir.manzoor

This is manuelly created Mappe1.pdf (82.6 KB)

@walterSPIRIT21

We suggest you please read the following article about column and row span of table.
ColSpan and RowSpan in Tables

You can use the approach shared in following code example to achieve your requirement. Hope this helps you.

var document = new Document
{
    Info =
                {
                    Author = "App",
                    Subject = "",
                    Title = "pdfTitle"
                }
};

document.PageInfo.IsLandscape = true;
document.PageInfo.Margin = new MarginInfo(28.3465, 72, 28.3465, 0);

var page = document.Pages.Insert(1);

var pageInfo = page.PageInfo;
pageInfo.IsLandscape = true;
var margin = pageInfo.Margin;
margin.Top = 80;
margin.Left = 30;
margin.Right = 30;
margin.Bottom = 15;

// Declare and define a new table
var protocolTable = new Table
{
    Border = new BorderInfo(BorderSide.All, 0.5f, Aspose.Pdf.Color.Black),
    DefaultCellBorder = new BorderInfo(BorderSide.All, 0.5f, Aspose.Pdf.Color.Black),
    DefaultCellTextState = new TextState("Arial"),
    DefaultCellPadding = new MarginInfo(6, 5, 4, 3),
    RepeatingRowsCount = 1,
    RepeatingColumnsCount = 1,
    ColumnWidths = "13% 13% 13% 50%"
};
// Add the table to the page
page.Paragraphs.Add(protocolTable);


// Add a new row to the table
var longRow = protocolTable.Rows.Add();
longRow.VerticalAlignment = VerticalAlignment.Center;
// I tried that, but have no effect
longRow.IsRowBroken = true;


Aspose.Pdf.Row row1 = protocolTable.Rows.Add();
for (int cellCount = 1; cellCount < 5; cellCount++)
{
    // Add table cells
    row1.Cells.Add();
}

row1.Cells[0].RowSpan = 3;
row1.Cells[1].RowSpan = 3;

TextFragment text = new TextFragment("Test");
row1.Cells[0].Paragraphs.Add(text);

text = new TextFragment("Test");
row1.Cells[1].Paragraphs.Add(text);

text = new TextFragment("Test");
row1.Cells[2].Paragraphs.Add(text);

text = new TextFragment("Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. ");
row1.Cells[3].Paragraphs.Add(text);


// Add 2nd row to table
Aspose.Pdf.Row row2 = protocolTable.Rows.Add();
row2.Cells.Add("Test");
row2.Cells.Add("Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. ");

// Add 3rd row to table
Aspose.Pdf.Row row3 = protocolTable.Rows.Add();
row3.Cells.Add("Test");
row3.Cells.Add("Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. ");

document.Save(MyDir + "22.1.pdf");

Hi @tahir.manzoor, Thank you for your code snippet. But this would not work if a random number of row will fit on a page. The “Text” of Cell[3] is the user input and is not allwasy this big.

Could you help me to find a way to know when aspose will makes a page break?

@walterSPIRIT21

Please set the value of Row.IsBroken and Table.IsBroken properties to true. Hope this helps you.

Yeah, thanks @tahir.manzoor.
This is helpful, not perfect and is not fixing all issues, but for now good enough.