You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
715 B
25 lines
715 B
using System.Collections.Generic;
|
|
using System.Linq;
|
|
|
|
namespace System.ComponentModel.DataAnnotations
|
|
{
|
|
public class ExcelHeaderAttribute : Attribute
|
|
{
|
|
public ExcelHeaderAttribute(string header, string range="4")
|
|
{
|
|
this.Header = header;
|
|
this.Headers = new Dictionary<string, int>();
|
|
var headers = header.Split(',');
|
|
var ranges = range.Split(',').Select(o => Convert.ToInt32(o)).ToList();
|
|
for (int i = 0; i < headers.Length; i++)
|
|
{
|
|
this.Headers.Add(headers[i], ranges[i]);
|
|
}
|
|
}
|
|
|
|
public string Header { get; }
|
|
public Dictionary<string, int> Headers { get; }
|
|
}
|
|
|
|
}
|