Browse Source

Updated report sample to follow new text style approach

Marcin Ziąbek 4 years ago
parent
commit
70e5783f0e

+ 2 - 1
QuestPDF.ReportSample/Layouts/ImageTemplate.cs

@@ -1,5 +1,6 @@
 using System;
 using System;
 using QuestPDF.Fluent;
 using QuestPDF.Fluent;
+using QuestPDF.Helpers;
 using QuestPDF.Infrastructure;
 using QuestPDF.Infrastructure;
 
 
 namespace QuestPDF.ReportSample.Layouts
 namespace QuestPDF.ReportSample.Layouts
@@ -24,7 +25,7 @@ namespace QuestPDF.ReportSample.Layouts
         {
         {
             container
             container
                 .AspectRatio(AspectRatio)
                 .AspectRatio(AspectRatio)
-                .Background("#EEEEEE")
+                .Background(Colors.Grey.Lighten3)
                 .Image(Source(Size.Zero));
                 .Image(Source(Size.Zero));
         }
         }
     }
     }

+ 6 - 6
QuestPDF.ReportSample/Layouts/PhotoTemplate.cs

@@ -48,13 +48,13 @@ namespace QuestPDF.ReportSample.Layouts
             {
             {
                 grid.Columns(6);
                 grid.Columns(6);
                 
                 
-                grid.Item().LabelCell().Text("Date", Typography.Normal);
-                grid.Item(2).ValueCell().Text(Model.Date?.ToString("g") ?? string.Empty, Typography.Normal);
-                grid.Item().LabelCell().Text("Location", Typography.Normal);
-                grid.Item(2).ValueCell().Text(Model.Location.Format(), Typography.Normal);
+                grid.Item().LabelCell().Text("Date");
+                grid.Item(2).ValueCell().Text(Model.Date?.ToString("g") ?? string.Empty);
+                grid.Item().LabelCell().Text("Location");
+                grid.Item(2).ValueCell().Text(Model.Location.Format());
                 
                 
-                grid.Item().LabelCell().Text("Comments", Typography.Normal);
-                grid.Item(5).ValueCell().Text(Model.Comments, Typography.Normal);
+                grid.Item().LabelCell().Text("Comments");
+                grid.Item(5).ValueCell().Text(Model.Comments);
             });
             });
         }
         }
     }
     }

+ 5 - 5
QuestPDF.ReportSample/Layouts/SectionTemplate.cs

@@ -30,11 +30,11 @@ namespace QuestPDF.ReportSample.Layouts
                         {
                         {
                             stack.Item().EnsureSpace(25).Row(row =>
                             stack.Item().EnsureSpace(25).Row(row =>
                             {
                             {
-                                row.ConstantColumn(150).LabelCell().Text(part.Label, Typography.Normal);
+                                row.ConstantColumn(150).LabelCell().Text(part.Label);
                                 var frame = row.RelativeColumn().ValueCell();
                                 var frame = row.RelativeColumn().ValueCell();
                             
                             
                                 if (part is ReportSectionText text)
                                 if (part is ReportSectionText text)
-                                    frame.ShowEntire().Text(text.Text, Typography.Normal);
+                                    frame.ShowEntire().Text(text.Text);
                         
                         
                                 if (part is ReportSectionMap map)
                                 if (part is ReportSectionMap map)
                                     frame.Element(x => MapElement(x, map));
                                     frame.Element(x => MapElement(x, map));
@@ -51,7 +51,7 @@ namespace QuestPDF.ReportSample.Layouts
         {
         {
             if (model.ImageSource == null || model.Location == null)
             if (model.ImageSource == null || model.Location == null)
             {
             {
-                container.Text("No location provided", Typography.Normal);
+                container.Text("No location provided");
                 return;
                 return;
             }
             }
 
 
@@ -60,7 +60,7 @@ namespace QuestPDF.ReportSample.Layouts
                 stack.Spacing(5);
                 stack.Spacing(5);
                 
                 
                 stack.Item().MaxWidth(250).AspectRatio(4 / 3f).Image(Placeholders.Image);
                 stack.Item().MaxWidth(250).AspectRatio(4 / 3f).Image(Placeholders.Image);
-                stack.Item().Text(model.Location.Format(), Typography.Normal);
+                stack.Item().Text(model.Location.Format());
             });
             });
         }
         }
         
         
@@ -68,7 +68,7 @@ namespace QuestPDF.ReportSample.Layouts
         {
         {
             if (model.Photos.Count == 0)
             if (model.Photos.Count == 0)
             {
             {
-                container.Text("No photos", Typography.Normal);
+                container.Text("No photos");
                 return;
                 return;
             }
             }
 
 

+ 2 - 2
QuestPDF.ReportSample/Layouts/StandardReport.cs

@@ -68,8 +68,8 @@ namespace QuestPDF.ReportSample.Layouts
                     {
                     {
                         grid.Item().Text(text =>
                         grid.Item().Text(text =>
                         {
                         {
-                            text.Span($"{field.Label}: ", Typography.Normal.SemiBold());
-                            text.Span(field.Value, Typography.Normal);
+                            text.Span($"{field.Label}: ", TextStyle.Default.SemiBold());
+                            text.Span(field.Value);
                         });
                         });
                     }
                     }
                 });
                 });

+ 3 - 3
QuestPDF.ReportSample/Layouts/TableOfContentsTemplate.cs

@@ -41,9 +41,9 @@ namespace QuestPDF.ReportSample.Layouts
                 .InternalLink(locationName)
                 .InternalLink(locationName)
                 .Row(row =>
                 .Row(row =>
                 {
                 {
-                    row.ConstantColumn(25).Text($"{number}.", Typography.Normal);
-                    row.RelativeColumn().Text(locationName, Typography.Normal);
-                    row.ConstantColumn(150).AlignRight().Text(text => text.PageNumberOfLocation(locationName, Typography.Normal));
+                    row.ConstantColumn(25).Text($"{number}.");
+                    row.RelativeColumn().Text(locationName);
+                    row.ConstantColumn(150).AlignRight().Text(text => text.PageNumberOfLocation(locationName));
                 });
                 });
         }
         }
     }
     }

+ 2 - 1
QuestPDF/Infrastructure/TextStyle.cs

@@ -1,4 +1,5 @@
-using QuestPDF.Helpers;
+using System;
+using QuestPDF.Helpers;
 
 
 namespace QuestPDF.Infrastructure
 namespace QuestPDF.Infrastructure
 {
 {