PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Sun Jul 14, 2024 12:51 am

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Paging Two Headers
PostPosted: Tue Oct 19, 2010 5:18 am 
Offline

Joined: Tue Oct 19, 2010 4:42 am
Posts: 2
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 4764 times ]
Top
 Profile  
Reply with quote  
 Post subject: Re: Paging Two Headers
PostPosted: Tue Oct 19, 2010 8:20 am 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3101
Location: Cologne, Germany
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.

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
 Post subject: Re: Paging Two Headers
PostPosted: Wed Oct 20, 2010 6:40 am 
Offline

Joined: Tue Oct 19, 2010 4:42 am
Posts: 2
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 4748 times ]
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC


Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 50 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Privacy Policy, Data Protection Declaration, Impressum
Powered by phpBB® Forum Software © phpBB Group