PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Wed Jun 23, 2021 3:12 pm

All times are UTC

Forum rules

Please read this before posting on this forum: Forum Rules

Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: Keeping tables together
PostPosted: Sat Feb 24, 2007 3:31 pm 

Joined: Tue Jan 30, 2007 12:27 pm
Posts: 3
I'm building up an expenditure report that has many costs, which has the following layout

Cost Type1
cost x
cost x
cost x
total xx

Cost Type2
cost x
cost x
cost x
total xx

Grand total xxx

I want to keep all of the costs together with their 'parent' cost type, so that i don't end up with a few rows spilling over on to the next page.

The approach i've taken is to add a new table to the same section each time i lay out a block of cost types, setting the keeptogether property to true, and adding a new row to the table each time i write a cost. However, i just can't seem to get tables to stay together.

The code i'm using is along the lines of:

private void fillTable(Section section)
Row r;

//loop through each cost type
foreach (costType c in CostTypes)
Table tblTable = new Table();

//add a table to the section
tblTable = base.AddATable(section);
tblTable.KeepTogether = true;

r = tblTable.AddRow();
r.Cells[0].AddParagraph("Cost Type Title");
r.HeadingFormat = true;

//loop through each of the costs that belong to the current cost type
foreach (cost cs in costs)
r = tblTable.AddRow();
r.Cell[1].AddParagraph("cost title");

Am i missing something?


Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC

Who is online

Users browsing this forum: No registered users and 15 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