CellExt.cs 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. using System;
  2. using FastReport.Table;
  3. namespace FastReport.AdvMatrix
  4. {
  5. internal static partial class CellExt
  6. {
  7. // cell extension methods
  8. public static CellDescriptor GetDescriptor(this TableCell cell)
  9. {
  10. return (CellDescriptor)cell.CellData.Value;
  11. }
  12. public static void SetDescriptor(this TableCell cell, CellDescriptor descriptor)
  13. {
  14. cell.CellData.Value = descriptor;
  15. }
  16. public static MatrixCollapseButton GetCollapseButton(this TableCell cell)
  17. {
  18. if (cell.Objects == null)
  19. return null;
  20. foreach (Base c in cell.Objects)
  21. {
  22. if (c is MatrixCollapseButton)
  23. return c as MatrixCollapseButton;
  24. }
  25. return null;
  26. }
  27. public static MatrixSortButton GetSortButton(this TableCell cell)
  28. {
  29. if (cell.Objects == null)
  30. return null;
  31. foreach (Base c in cell.Objects)
  32. {
  33. if (c is MatrixSortButton)
  34. return c as MatrixSortButton;
  35. }
  36. return null;
  37. }
  38. }
  39. }