tags:

views:

42

answers:

0
[ExcelSheet(Name = "A", Sn = "A")]
public class A : System.ComponentModel.INotifyPropertyChanged
{

    public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;

    public virtual void SendPropertyChanged(string propertyName)
    {
        System.ComponentModel.PropertyChangedEventHandler handler = PropertyChanged;
        if (handler != null)
        {
            handler(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName));
        }
    }


    [ExcelColumn(Name = "C1", Storage = "C1")]
    public string C1 { get; set; }
}
//BCDEF ..... class Omission
 ===========================================================================================
  codeprovider    = ExcelProvider.Create(AppDomain.CurrentDomain.BaseDirectory + @"\code_data.xlsx");
  _A   = (from p in codeprovider.GetSheet3<A>() select p).AsParallel().ToList<A>();
  _B   = (from p in codeprovider.GetSheet3<B>() select p).AsParallel().ToList<B>();
  _C   = (from p in codeprovider.GetSheet3<C>() select p).AsParallel().ToList<C>();
  _D   = (from p in codeprovider.GetSheet3<D>() select p).AsParallel().ToList<D>();

  // ...........  logic omission
  _Z   = (from p in codeprovider.GetSheet3<Z>() select p).AsParallel().ToList<Z>();

Excel File's Sheet Get data.

If A, B, C, D .... Z when there is a class _A, _B ..... _Z Decide the type of field names

List<T> list = (from p in provider.GetSheet<T>() select p).AsParallel().ToList<T>();

Is there to fetch the data?

A, B, C, D, E, ... Z of the data sheets are imported. Using the same pattern'm messed up the code

core reference : http://solidcodingarchive.appspot.com/resources/LinqExcelProvider25.cs