Commit d515136c authored by Uta Christoph's avatar Uta Christoph
Browse files

Merge branch 'fix/876-url-in-measure-table' into 'master'

From fix/876-url-in-measure-table into master

See merge request datencockpit-open/pdf-generator!15
parents 857d9e30 318dde10
Pipeline #434715 passed with stages
in 29 seconds
......@@ -113,7 +113,9 @@ namespace PDFGenerator.DocumentStructures.EvaluationReport
new Paragraph(
new Text(text).AddStyle(Styles.Small).SetFontColor(ColorConstants.BLACK)
).SetMultipliedLeading(0.9f)
).SetPadding(4.7f);
)
.SetKeepTogether(true)
.SetPadding(4.7f);
if (leftColumn)
{
......
......@@ -113,7 +113,7 @@ namespace PDFGenerator.DocumentStructures.EvaluationReport
private void AddMeasureSection(MeasureTable measureTable)
{
Table table = new Table(UnitValue.CreatePercentArray(new float[] { 1f, 1f, 1f, 1f, 1f, 1f, 1f, 1f, 1f, 1f }), false)
.UseAllAvailableWidth().SetKeepTogether(false).SetMarginTop(4f).SetMarginBottom(10f);
.UseAllAvailableWidth().SetFixedLayout().SetKeepTogether(false).SetMarginTop(4f).SetMarginBottom(10f);
// only show header if there are measures or some other content
......@@ -131,7 +131,7 @@ namespace PDFGenerator.DocumentStructures.EvaluationReport
measureTable.Measures.ForEach(measure =>
{
// first row
table.AddCell(new Cell().Add(new Paragraph(new Text("Kriterium/ Kennzahl").AddStyle(Styles.SmallBold)).SetMultipliedLeading(1f)).SetPaddingBottom(0));
table.AddCell(new Cell().SetKeepTogether(true).Add(new Paragraph(new Text("Kriterium/ Kennzahl").AddStyle(Styles.SmallBold)).SetMultipliedLeading(1f)).SetPaddingBottom(0));
table.AddCell(new Cell(1, 4).Add(new Paragraph(new Text("Studiengang").AddStyle(Styles.SmallBold))).SetVerticalAlignment(VerticalAlignment.MIDDLE).SetPaddingBottom(0));
table.AddCell(new Cell().Add(new Paragraph(new Text("Fristigkeit").AddStyle(Styles.SmallBold))).SetVerticalAlignment(VerticalAlignment.MIDDLE).SetPaddingBottom(0));
table.AddCell(new Cell(1, 4).Add(new Paragraph(new Text("Zuständigkeit").AddStyle(Styles.SmallBold))).SetVerticalAlignment(VerticalAlignment.MIDDLE).SetPaddingBottom(0));
......@@ -140,17 +140,17 @@ namespace PDFGenerator.DocumentStructures.EvaluationReport
table.AddCell(new Cell(3, 1).Add(new Paragraph(new Text(measure.FullId).AddStyle(Styles.Small)).SetMultipliedLeading(1f)).SetPaddingBottom(0));
// second row
table.AddCell(new Cell(1, 4).Add(new Paragraph(new Text(measure.CourseName).AddStyle(Styles.Small)).SetMultipliedLeading(0.9f)).SetPaddingBottom(0));
table.AddCell(new Cell(1, 4).SetKeepTogether(true).Add(new Paragraph(new Text(measure.CourseName).AddStyle(Styles.Small)).SetMultipliedLeading(0.9f)).SetPaddingBottom(0));
table.AddCell(new Cell().Add(new Paragraph(new Text(measure.Maturity).AddStyle(Styles.Small)).SetMultipliedLeading(0.9f)).SetPaddingBottom(0));
table.AddCell(new Cell(1, 4).Add(new Paragraph(new Text(measure.Responsibilities).AddStyle(Styles.Small)).SetMultipliedLeading(0.9f)).SetPaddingBottom(0));
table.AddCell(new Cell(1, 4).SetKeepTogether(true).Add(new Paragraph(new Text(measure.Responsibilities).AddStyle(Styles.Small)).SetMultipliedLeading(0.9f)).SetPaddingBottom(0));
// third row
table.AddCell(new Cell(1, 4).Add(new Paragraph(new Text("Maßnahme").AddStyle(Styles.SmallBold)).SetMultipliedLeading(1f)).SetPaddingBottom(0));
table.AddCell(new Cell(1, 5).Add(new Paragraph(new Text("Kommentar").AddStyle(Styles.SmallBold)).SetMultipliedLeading(1f)).SetPaddingBottom(0));
// fourth row
table.AddCell(new Cell(1, 4).Add(new Paragraph(new Text(measure.Description).AddStyle(Styles.Small)).SetMultipliedLeading(0.9f)).SetPaddingBottom(0));
table.AddCell(new Cell(1, 5).Add(new Paragraph(new Text(measure.Comments).AddStyle(Styles.Small)).SetMultipliedLeading(0.9f)).SetPaddingBottom(0));
table.AddCell(new Cell(1, 4).SetKeepTogether(true).Add(new Paragraph(new Text(measure.Description).AddStyle(Styles.Small)).SetMultipliedLeading(0.9f)).SetPaddingBottom(0));
table.AddCell(new Cell(1, 5).SetKeepTogether(true).Add(new Paragraph(new Text(measure.Comments).AddStyle(Styles.Small)).SetMultipliedLeading(0.9f)).SetPaddingBottom(0));
});
// message for non-available measures if available
......
......@@ -44,6 +44,7 @@ namespace PDFGenerator.Renderers
// create document to add new elements
Document = new Document(pdfDocument, PageSize.A4);
Document.SetMargins(Margins.TopMargin, Margins.RightMargin, Margins.BottomMargin, Margins.LeftMargin);
Document.SetProperty(Property.SPLIT_CHARACTERS, new CustomSplitCharacters());
Bookmarks = new Bookmarks();
TableOfContents = new TableOfContents(Document);
......
using iText.IO.Font.Otf;
using iText.Layout.Splitting;
namespace PDFGenerator.Utilities
{
public class CustomSplitCharacters : DefaultSplitCharacters
{
public override bool IsSplitCharacter(GlyphLine text, int glyphPos)
{
// default itext split strategy: find empty space and hyphen characters
if (base.IsSplitCharacter(text, glyphPos))
{
return true;
}
int charCode = text.Get(glyphPos).GetUnicode();
return (charCode == '_' || charCode == '&' || charCode == '?' ||
charCode == '=' || charCode == '/');
}
}
}
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