HeaderFooterBandBase.cs 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4. using System.ComponentModel;
  5. using FastReport.Utils;
  6. namespace FastReport
  7. {
  8. /// <summary>
  9. /// Base class for headers and footers which support the "Keep With Data" and "Repeat on Every Page" features.
  10. /// </summary>
  11. public partial class HeaderFooterBandBase : BandBase
  12. {
  13. #region Fields
  14. private bool keepWithData;
  15. private bool repeatOnEveryPage;
  16. #endregion
  17. #region Properties
  18. /// <summary>
  19. /// Gets or sets a value indicating that the band should be printed together with data band.
  20. /// </summary>
  21. [DefaultValue(false)]
  22. [Category("Behavior")]
  23. public bool KeepWithData
  24. {
  25. get { return keepWithData; }
  26. set { keepWithData = value; }
  27. }
  28. /// <summary>
  29. /// Gets or sets a value that determines whether to repeat this band on every page.
  30. /// </summary>
  31. /// <remarks>
  32. /// When band is repeated, its <see cref="BandBase.Repeated"/> property is set to <b>true</b>. You can use
  33. /// it to show any additional information on the band. To do this,
  34. /// use the <see cref="ReportComponentBase.PrintOn"/> property which
  35. /// can be set to "Rpeeated". In that case the object will be printed
  36. /// only on the repeated band.
  37. /// </remarks>
  38. [DefaultValue(false)]
  39. [Category("Behavior")]
  40. public bool RepeatOnEveryPage
  41. {
  42. get { return repeatOnEveryPage; }
  43. set { repeatOnEveryPage = value; }
  44. }
  45. #endregion
  46. #region Public Methods
  47. /// <inheritdoc/>
  48. public override void Assign(Base source)
  49. {
  50. base.Assign(source);
  51. HeaderFooterBandBase src = source as HeaderFooterBandBase;
  52. KeepWithData = src.KeepWithData;
  53. RepeatOnEveryPage = src.RepeatOnEveryPage;
  54. }
  55. /// <inheritdoc/>
  56. public override void Serialize(FRWriter writer)
  57. {
  58. HeaderFooterBandBase c = writer.DiffObject as HeaderFooterBandBase;
  59. base.Serialize(writer);
  60. if (KeepWithData != c.KeepWithData)
  61. writer.WriteBool("KeepWithData", KeepWithData);
  62. if (RepeatOnEveryPage != c.RepeatOnEveryPage)
  63. writer.WriteBool("RepeatOnEveryPage", RepeatOnEveryPage);
  64. }
  65. #endregion
  66. }
  67. }