Hi,
I have a problem with paragraphs using the document builder. I have a loop that generates input like this:
DocumentBuilder builder = new DocumentBuilder(doc);
builder.MoveToBookmark(“Prognos”);
foreach (Contract contract in contracts)
{
ParagraphFormat paragraphFormat = builder.ParagraphFormat;
paragraphFormat.Borders.Bottom.LineStyle = LineStyle.Single;
paragraphFormat.Borders.Bottom.LineWidth = 1.5;
paragraphFormat.Borders.Bottom.Color = Color.Red;
paragraphFormat.KeepTogether = true;
builder.Write(“Kund: “);
builder.Write(contract.CustomerName);
builder.Write(” Kundnummer: “);
builder.Write(contract.Customer);
builder.Write(” Uppdrag: “);
builder.Write(contract.Number);
builder.InsertBreak(BreakType.LineBreak);
builder.Write(“Lönekostnad dag “);
builder.Write(String.Format(”{0:# ##0 kr}”, contract.prognos.WeekDaySalaryCost));
builder.Write(” Lönekostnad kväll “);
builder.Write(String.Format(”{0:# ##0 kr}”, contract.prognos.EveneingSalaryCost));
builder.Write(" Lönekostnad totalt “);
builder.Write(String.Format(”{0:# ##0 kr}", contract.prognos.TotalSalaryCost));
builder.InsertBreak(BreakType.LineBreak);
builder.InsertBreak(BreakType.ParagraphBreak);
}
This way I thought that I would get a separate pragraph for each iteration in the foreach loop. Looking at the result however gives me the impression that I have one paragraph per page since the red border appears at the bottom of each page - not after each iteration as I thought it would
What is wrong in the code above?
Best regards
Robert Tell