Exemple #1
0
        public ExistingFileAndSheetControl(ConnectToExcelConfiguration configuration)
        {
            InitializeComponent();
            this.DataContext = this.configuration = configuration;

            if (String.IsNullOrEmpty(configuration.FilePath) == false)
            {
                InitializeConnection(configuration.FilePath);
            }

            if (String.IsNullOrEmpty(configuration.SheetName) == false)
            {
                ddSheetsInWorkbook.SelectedItem = ddSheetsInWorkbook.Items.Cast <string>().
                                                  Where(t => t == configuration.SheetName).FirstOrDefault();
            }
        }
        public void GeneralLoadTestExcel()
        {
            ConnectToExcelConfiguration configuration = new ConnectToExcelConfiguration();

            configuration.FilePath  = @"TestData\LoadFromExcel\TestData.xlsx";
            configuration.SheetName = "Contacts";

            IConnection excelConnection = new ConnectToExcel()
            {
                Configuration = configuration
            };

            IDataSource loadFromExcel = new LoadFromExcel();

            IDatastore dataObject = DataStoreFactory.GetDatastore();

            loadFromExcel.LoadData(excelConnection, dataObject, ReportProgressMethod);
        }
Exemple #3
0
        public static IDatastore LoadExcelsheet(string sheetPath, string sheetName)
        {
            ConnectToExcelConfiguration configuration = new ConnectToExcelConfiguration();

            configuration.FilePath  = sheetPath;
            configuration.SheetName = sheetName;

            IConnection excelConnection = new ConnectToExcel()
            {
                Configuration = configuration
            };

            IDataSource loadFromExcel = new LoadFromExcel();

            IDatastore dataStore = DataStoreFactory.GetDatastore();

            loadFromExcel.LoadData(excelConnection, dataStore, ReportProgressMethod);

            return(dataStore);
        }
 public NewFileAndSheetControl(ConnectToExcelConfiguration configuration)
 {
     InitializeComponent();
     this.DataContext = this.configuration = configuration;
 }