Commit 45e18106 authored by Nuno Alves's avatar Nuno Alves
Browse files

From feature/851-absb-question-layout into master

parent ef3a4c92
......@@ -47,7 +47,7 @@ namespace PDFGenerator.DocumentStructures.FactSheet
Table = new Table(1, false)
.UseAllAvailableWidth().SetKeepTogether(false);
AddParagrpahToTable(ParagraphFactory.GetCustomParagraph(PDFChapter.Title.Name, HeadlineLevel[PDFChapter.Title.Level], 5.0f, 0, 1.12f));
AddParagraphToTable(ParagraphFactory.GetCustomParagraph(PDFChapter.Title.Name, HeadlineLevel[PDFChapter.Title.Level], 5.0f, 0, 1.12f));
for (int i = 0; i < PDFChapter.ReportSections.Count; i++)
{
......@@ -60,20 +60,34 @@ namespace PDFGenerator.DocumentStructures.FactSheet
foreach (Headline headline in PDFChapter.ReportSections[i].Headlines)
{
// give hihgher space in between report sections, if the report section is neither the first nor the current position is on the page top
float spacinfBefore = i == 0 || IsCurrentPositionOnPageTop() || headline.Name != PDFChapter.ReportSections[i].Headlines[0].Name ? 3.0f : 15.0f;
float spacingBefore = i == 0 || IsCurrentPositionOnPageTop() || headline.Name != PDFChapter.ReportSections[i].Headlines[0].Name ? 3.0f : 15.0f;
bool isItalic = ItalicStyleForExpressions.Any(expression => headline.Name.ToLower().Contains(expression));
AddParagrpahToTable(ParagraphFactory.GetCustomParagraph(headline.Name, HeadlineLevel[headline.Level], spacinfBefore, 0, 1.1f, isItalic));
AddParagraphToTable(ParagraphFactory.GetCustomParagraph(headline.Name, HeadlineLevel[headline.Level], spacingBefore, 0, 1.1f, isItalic));
}
}
if (PDFChapter.ReportSections[i].Header != null)
{
AddParagrpahToTable(
ParagraphFactory.GetCustomParagraph(PDFChapter.ReportSections[i].Header.Name, HeadlineLevel[PDFChapter.ReportSections[i].Header.Level], 9.0f, 0, 1.12f)
.SetTextAlignment(TextAlignment.CENTER)
);
PDFChapter.ReportSections[i].Header.ForEach(item =>
{
float spacingBefore = 9f;
if (item.Level == Level.ReportHeader)
{
spacingBefore = PDFChapter.ReportSections[i].Headlines == null && item.Level == Level.ReportHeader ? 18f : spacingBefore;
spacingBefore = IsCurrentPositionOnPageTop() ? 0f : spacingBefore;
}
else
{
spacingBefore = 7f;
}
AddParagraphToTable(
ParagraphFactory.GetCustomParagraph(item.Name, HeadlineLevel[item.Level], spacingBefore, 0, 1.12f)
.SetTextAlignment(TextAlignment.CENTER)
);
});
}
if (PDFChapter.ReportSections[i].Images != null)
......@@ -87,7 +101,7 @@ namespace PDFGenerator.DocumentStructures.FactSheet
else
{
// display the no data available message
AddParagrpahToTable(ParagraphFactory.GetCustomParagraph(CommonMessage.Name, HeadlineLevel[CommonMessage.Level], 8.0f, 11.0f, 1.12f));
AddParagraphToTable(ParagraphFactory.GetCustomParagraph(CommonMessage.Name, HeadlineLevel[CommonMessage.Level], 8.0f, 11.0f, 1.12f));
}
reportSectionRendered = true;
......@@ -165,7 +179,7 @@ namespace PDFGenerator.DocumentStructures.FactSheet
/// Creates a cell with the given paragraph and adds it to the table.
/// </summary>
/// <param name="paragraph">input paragraph to be added.</param>
private void AddParagrpahToTable(Paragraph paragraph)
private void AddParagraphToTable(Paragraph paragraph)
{
Cell cell = new Cell()
.SetBorder(Border.NO_BORDER)
......
......@@ -21,6 +21,7 @@ namespace PDFGenerator.DocumentStructures.FactSheet
{ Level.Level_5, Styles.H4},
{ Level.Paragraph, Styles.Paragraph},
{ Level.ReportHeader, Styles.ReportHeader},
{ Level.ReportSubHeader, Styles.ReportSubHeader},
};
}
}
......@@ -2,7 +2,7 @@ using System.Collections.Generic;
namespace PDFGenerator.Models.FactSheet
{
public enum Level { Level_0, Level_1, Level_2, Level_3, Level_4, Level_5, ReportHeader, Paragraph }
public enum Level { Level_0, Level_1, Level_2, Level_3, Level_4, Level_5, ReportHeader, ReportSubHeader, Paragraph }
public enum Alignment { Left, Right }
public class Headline
......@@ -26,7 +26,7 @@ namespace PDFGenerator.Models.FactSheet
public class ReportSection
{
public List<Headline> Headlines { get; set; }
public Headline Header { get; set; }
public List<Headline> Header { get; set; }
public List<byte[]> Images { get; set; }
}
......
......@@ -72,6 +72,7 @@ namespace PDFGenerator.Utilities
public static Style H3 => new Style().SetFont(NormalFont).SetFontSize(11).SetFontColor(DefaultFontColor);
public static Style H4 => new Style().SetFont(NormalFont).SetFontSize(10).SetFontColor(DefaultFontColor);
public static Style ReportHeader => new Style().SetFont(BoldFont).SetFontSize(9).SetFontColor(DefaultFontColor);
public static Style ReportSubHeader => new Style().SetFont(NormalFont).SetFontSize(9).SetFontColor(DefaultFontColor);
public static Style Paragraph => new Style().SetFont(NormalFont).SetFontSize(11);
public static Style Footer => new Style().SetFont(NormalFont).SetFontSize(10).SetFontColor(HeaderFooterFontColor);
public static Style Header => new Style().SetFont(NormalFont).SetFontSize(12).SetFontColor(HeaderFooterFontColor);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment