DefaultTextStyleExamples.cs 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. using System.Drawing;
  2. using System.Linq;
  3. using NUnit.Framework;
  4. using QuestPDF.Examples.Engine;
  5. using QuestPDF.Fluent;
  6. using QuestPDF.Helpers;
  7. using QuestPDF.Infrastructure;
  8. namespace QuestPDF.Examples
  9. {
  10. public class DefaultTextStyleExamples
  11. {
  12. [Test]
  13. public void Placeholder()
  14. {
  15. RenderingTest
  16. .Create()
  17. .PageSize(220, 270)
  18. .ProduceImages()
  19. .ShowResults()
  20. .EnableDebugging()
  21. .Render(container =>
  22. {
  23. container
  24. .Padding(10)
  25. .DefaultTextStyle(TextStyle.Default.Bold().Underline())
  26. .Column(column =>
  27. {
  28. column.Item().Text("Default style applies to all children");
  29. column.Item().Text("You can override certain styles").Underline(false).FontColor(Colors.Green.Darken2);
  30. column.Item().PaddingTop(10).Border(1).Grid(grid =>
  31. {
  32. grid.Columns(4);
  33. foreach (var i in Enumerable.Range(1, 16))
  34. {
  35. grid.Item()
  36. .Border(1)
  37. .BorderColor(Colors.Grey.Lighten1)
  38. .Background(Colors.Grey.Lighten3)
  39. .Width(50)
  40. .Height(50)
  41. .AlignCenter()
  42. .AlignMiddle()
  43. .Text(i)
  44. .FontSize(16 + i / 4);
  45. }
  46. });
  47. });
  48. });
  49. }
  50. }
  51. }