PDFsharp & MigraDoc Foundation
http://forum.pdfsharp.de/

Page Breaks
http://forum.pdfsharp.de/viewtopic.php?f=2&t=799
Page 1 of 1

Author:  sbilo [ Thu Jul 23, 2009 5:49 pm ]
Post subject:  Page Breaks

I have a process that adds alternating Images and Tables. (each set has a large image followed by a table). Before each set of Image and associated Table I add a bookmark. I need to force new page breaks everytime the bookmark is added and everytime the table is added. How can I cause these page breaks?


foreach (Assembly thisAssembly in assemblyList)
{

// NEED PAGE BREAK HERE SO THIS HEADING AND IMAGE IS ON A SEPARATE PAGE

Paragraph paragraph = document.LastSection.AddParagraph(thisAssembly.number + " " + thisAssembly.description, "Heading2");
paragraph.AddBookmark(thisAssembly.number + " " + thisAssembly.description);


completeFilename = directoryLocation + "\\" + pic.artnumber + "." + pic.fileextension;
document.LastSection.AddImage(completeFilename);


Table table = new Table();

Column column = table.AddColumn(Unit.FromCentimeter(1.2));
column.Format.Alignment = ParagraphAlignment.Center;
column = table.AddColumn(Unit.FromCentimeter(3.9));
column.Format.Alignment = ParagraphAlignment.Center;
column = table.AddColumn(Unit.FromCentimeter(.9));
column.Format.Alignment = ParagraphAlignment.Center;
column = table.AddColumn(Unit.FromCentimeter(6.1));
column = table.AddColumn(Unit.FromCentimeter(7));

Cell cell;
Row row = table.AddRow();
row.Shading.Color = Colors.PaleGoldenrod;
cell = row.Cells[0];
cell.AddParagraph("ITEM");
cell = row.Cells[1];
cell.AddParagraph("PARTNUMBER");
cell = row.Cells[2];
cell.AddParagraph("QTY");
cell = row.Cells[3];
cell.AddParagraph("DESCRIPTION");
cell = row.Cells[4];
cell.AddParagraph("NOTES");


// loop thru datareader to add rows


// NEED PAGE BREAK HERE SO THIS HEADING AND TABLE IS ON A SEPARATE PAGE


document.LastSection.AddParagraph(thisAssembly.number + " " + thisAssembly.description, "Heading2");

document.LastSection.Add(table);

}


//thanks !

Author:  Thomas Hoevel [ Mon Jul 27, 2009 9:04 am ]
Post subject:  Re: Page Breaks

Code:
Document.LastSection.AddPageBreak();

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