PDFsharp & MigraDoc Foundation
https://forum.pdfsharp.net/

Paging Two Headers
https://forum.pdfsharp.net/viewtopic.php?f=2&t=1377
Page 1 of 1

Author:  chadJ [ Tue Oct 19, 2010 5:18 am ]
Post subject:  Paging Two Headers

I have a table with a header row that successfully breaks from one page to the next by setting row.HeadingFormat = true.

Above the data table there is a section header that also needs to move with the data table (the blue "Adjustments" header, which is in it's own table), and be appended with the text "continued". Any suggestions how to do this? Thanks.

Attachments:
File comment: Example1
example1.JPG
example1.JPG [ 25.12 KiB | Viewed 4765 times ]

Author:  Thomas Hoevel [ Tue Oct 19, 2010 8:20 am ]
Post subject:  Re: Paging Two Headers

chadJ wrote:
Any suggestions how to do this?

If you make this a single table with two heading rows, then it should work - except for the "continued" on the second page.
You can add a dummy column at the left that is only used for the blue header (with MergeRight) and left blank for the other rows.

Author:  chadJ [ Wed Oct 20, 2010 6:40 am ]
Post subject:  Re: Paging Two Headers

I was able to get two headers to work per your instructions by adding row.HeadingFormat = true to both. I should also note for everyone else, it is necessary for the header row to be the first row of the table, and there cannot be a row in between the two rows.

In an attempt to get "continued" to appear on the second page in one of the headers, I unsuccessfully tried the code below. If anyone has gotten something similar to work, please share. Thanks, cj

table.Comment = "PossibleSplitTable";

Paragraph header1 = new Paragraph();
header1.AddText("Adjustments");

Paragraph header2 = new Paragraph();
header2.AddText("Adjustments (continued)");

row = table.AddRow();
cell = row.Cells[0];
cell.Add(header1);
cell.Add(header2);

*This code for testing attempt only, I tried in TopDownFormatter.cs of the Migradoc codebase...
Table tableTest = (Table)docObj;

if (isFirstOnPage == true)
{
if (tableTest.Comment == "PossibleSplitTable")
{
tableTest.Rows[0][0].Elements.RemoveObjectAt(0);
}
}
else
{
if (tableTest.Comment == "PossibleSplitTable")
{
tableTest.Rows[0][0].Elements.RemoveObjectAt(1);
}
}

docObj = (DocumentObject)tableTest;

Attachments:
example2.JPG
example2.JPG [ 29.34 KiB | Viewed 4749 times ]

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/