ExcelMappingItem.cs 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. using System.Linq.Expressions;
  2. using System.Reflection;
  3. namespace XYY.Core.Standard.ExcelHelper.MSExcelHelper
  4. {
  5. public class ExcelMappingItem
  6. {
  7. /// <summary>
  8. /// 列名
  9. /// </summary>
  10. public string ColumnName
  11. {
  12. get; set;
  13. }
  14. public ExcelMappingItem Name(string name)
  15. {
  16. this.ColumnName = name;
  17. return this;
  18. }
  19. public string ColumnAnnotation
  20. {
  21. get; set;
  22. }
  23. public ExcelMappingItem Annotation(string annotation)
  24. {
  25. this.ColumnAnnotation = annotation;
  26. return this;
  27. }
  28. public PropertyInfo PropertyInfo
  29. {
  30. get; set;
  31. }
  32. /// <summary>
  33. /// 列名表达式
  34. /// </summary>
  35. public LambdaExpression LambdaExpression
  36. {
  37. get; set;
  38. }
  39. /// <summary>
  40. /// 列宽,默认使用该列文本值的最长宽度。
  41. /// 限制最长宽度为50个字符。
  42. /// </summary>
  43. public int ColumnWidht
  44. {
  45. get; set;
  46. }
  47. public ExcelMappingItem Width(int width)
  48. {
  49. this.ColumnWidht = width;
  50. return this;
  51. }
  52. /// <summary>
  53. /// 格式化文本
  54. /// </summary>
  55. public string ColumnFormattext
  56. {
  57. get; set;
  58. }
  59. public ExcelMappingItem Formattext(string text)
  60. {
  61. this.ColumnFormattext = text;
  62. return this;
  63. }
  64. }
  65. }