Skip to content

Instantly share code, notes, and snippets.

@cjlotz
Created April 2, 2013 19:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cjlotz/5295215 to your computer and use it in GitHub Desktop.
Save cjlotz/5295215 to your computer and use it in GitHub Desktop.
private void WriteWorkItems(string chapterText, ref int chapterNumber, IEnumerable<ReleaseNoteWorkItem> workItems)
{
if (!workItems.Any())
return;
_document.NewPage();
string chapterTitle = string.Format(CultureInfo.InvariantCulture, "{0}. {1}", chapterNumber++, chapterText);
var chapter = new Chunk(chapterTitle, _chapterFont);
var paragraph = new Paragraph(20f, chapter);
chapter.SetLocalDestination(_writer.PageNumber.ToString(CultureInfo.InvariantCulture));
Bookmarks.Add(new Bookmark(chapterTitle, _writer.PageNumber));
_document.Add(paragraph);
_table = new PdfPTable(4);
_table.SpacingBefore = 10f;
_table.WidthPercentage = 100;
_table.DefaultCell.BorderColor = _headerColor;
_table.DefaultCell.BorderWidth = 100;
_table.DefaultCell.Padding = 100;
_table.SetWidths(new[] { 18f, 35f, 35f, 12f });
_table.DefaultCell.VerticalAlignment = Element.ALIGN_TOP;
WriteTableHeader();
foreach (var grouping in workItems.OrderBy(x => x.Area).GroupBy(x => x.Area))
{
foreach (var workItem in grouping.OrderBy(x => x.WorkItemId))
{
WriteTableRow(workItem);
}
}
_document.Add(_table);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment