Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
PDSLLabs Public
QMSL
PDFGenerator QMSL
Commits
45e18106
Commit
45e18106
authored
Mar 05, 2021
by
Nuno Alves
Browse files
From feature/851-absb-question-layout into master
parent
ef3a4c92
Changes
4
Hide whitespace changes
Inline
Side-by-side
pdf-generator/DocumentStructures/FactSheet/Chapter.cs
View file @
45e18106
...
...
@@ -47,7 +47,7 @@ namespace PDFGenerator.DocumentStructures.FactSheet
Table
=
new
Table
(
1
,
false
)
.
UseAllAvailableWidth
().
SetKeepTogether
(
false
);
AddParagr
p
ahToTable
(
ParagraphFactory
.
GetCustomParagraph
(
PDFChapter
.
Title
.
Name
,
HeadlineLevel
[
PDFChapter
.
Title
.
Level
],
5.0f
,
0
,
1.12f
));
AddParagra
p
hToTable
(
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
spacin
f
Before
=
i
==
0
||
IsCurrentPositionOnPageTop
()
||
headline
.
Name
!=
PDFChapter
.
ReportSections
[
i
].
Headlines
[
0
].
Name
?
3.0f
:
15.0f
;
float
spacin
g
Before
=
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
));
AddParagr
p
ahToTable
(
ParagraphFactory
.
GetCustomParagraph
(
headline
.
Name
,
HeadlineLevel
[
headline
.
Level
],
spacin
f
Before
,
0
,
1.1f
,
isItalic
));
AddParagra
p
hToTable
(
ParagraphFactory
.
GetCustomParagraph
(
headline
.
Name
,
HeadlineLevel
[
headline
.
Level
],
spacin
g
Before
,
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
AddParagr
p
ahToTable
(
ParagraphFactory
.
GetCustomParagraph
(
CommonMessage
.
Name
,
HeadlineLevel
[
CommonMessage
.
Level
],
8.0f
,
11.0f
,
1.12f
));
AddParagra
p
hToTable
(
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
AddParagr
p
ahToTable
(
Paragraph
paragraph
)
private
void
AddParagra
p
hToTable
(
Paragraph
paragraph
)
{
Cell
cell
=
new
Cell
()
.
SetBorder
(
Border
.
NO_BORDER
)
...
...
pdf-generator/DocumentStructures/FactSheet/FactSheetBaseSection.cs
View file @
45e18106
...
...
@@ -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
},
};
}
}
pdf-generator/Models/FactSheet.cs
View file @
45e18106
...
...
@@ -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
;
}
}
...
...
pdf-generator/Utilities/Globals.cs
View file @
45e18106
...
...
@@ -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
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment