PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Thu Apr 15, 2021 6:23 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 
Offline

Joined: Tue Jan 30, 2007 12:27 pm
Posts: 3
Hi,
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;
addColumns(tblTable);

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");
r.Cell[2].AddParagraph("0.00");
}
}
}

Am i missing something?

Thanks,
Chris.


Top
 Profile  
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: Bing [Bot] and 12 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