private void btnAbrirArchivo_Click(object sender, RoutedEventArgs e)
        {
            //abro el archivo de Excel
            IWorkbook wb = WorkbookFactory.Create(new FileStream(PathOfFile, FileMode.Open, FileAccess.Read));

            //HOJA 1
            {
                var zonaLogis = string.Empty;
                var nombre    = string.Empty;

                var sheet = wb.GetSheetAt(0);//primera hoja
                var tab   = new TabItem();
                tab.Header = sheet.SheetName;
                var dgHoja = new DataGrid();

                for (int i = 0; i < sheet.LastRowNum; i++)
                {
                    zonaLogis = sheet.GetRow(i).GetCell(0).ToString().Trim();
                    nombre    = sheet.GetRow(i).GetCell(1).ToString().Trim();
                    Hoja_1.Add(new Tuple <string, string>(zonaLogis, nombre));
                }
                dgHoja.ItemsSource = Hoja_1;
                tab.Content        = dgHoja;
                tabControl.Items.Add(tab);
            }

            //HOJA 2
            {
                var zonaComer = string.Empty;
                var zonaLogis = string.Empty;

                var sheet = wb.GetSheetAt(1);//primera hoja
                var tab   = new TabItem();
                tab.Header = sheet.SheetName;
                var dgHoja = new DataGrid();

                for (int i = 0; i < sheet.LastRowNum; i++)
                {
                    zonaComer = sheet.GetRow(i).GetCell(0).ToString().Trim();
                    zonaLogis = sheet.GetRow(i).GetCell(1).ToString().Trim();

                    Hoja_2.Add(new Tuple <string, string>(zonaComer, zonaLogis));
                }
                dgHoja.ItemsSource = Hoja_2;
                tab.Content        = dgHoja;
                tabControl.Items.Add(tab);
            }

            //HOJA 3
            {
                var cliente   = string.Empty;
                var zonaLogis = string.Empty;

                var sheet = wb.GetSheetAt(2);//primera hoja
                var tab   = new TabItem();
                tab.Header = sheet.SheetName;
                var dgHoja = new DataGrid();

                for (int i = 0; i < sheet.LastRowNum; i++)
                {
                    cliente   = sheet.GetRow(i).GetCell(0).ToString().Trim();
                    zonaLogis = sheet.GetRow(i).GetCell(1).ToString().Trim();

                    Hoja_3.Add(new Tuple <string, string>(cliente, zonaLogis));
                }
                dgHoja.ItemsSource = Hoja_3;
                tab.Content        = dgHoja;
                tabControl.Items.Add(tab);
            }
        }
        private void btnAbrirArchivo_Click(object sender, RoutedEventArgs e)
        {
            //abro el archivo de Excel
            IWorkbook wb = WorkbookFactory.Create(new FileStream(PathOfFile, FileMode.Open, FileAccess.Read));

            //HOJA 1
            {
                var zona        = string.Empty;
                var nombre      = string.Empty;
                var empresa     = string.Empty;
                var empresa_rel = string.Empty;
                var operador    = string.Empty;
                var region      = string.Empty;
                var ciudad      = string.Empty;

                var sheet = wb.GetSheetAt(0);//primera hoja
                var tab   = new TabItem();
                tab.Header = sheet.SheetName;
                var dgHoja = new DataGrid();

                for (int i = 0; i <= sheet.LastRowNum; i++)
                {
                    zona        = sheet.GetRow(i).GetCell(0).ToString().Trim();
                    nombre      = sheet.GetRow(i).GetCell(1).ToString().Trim();
                    empresa     = sheet.GetRow(i).GetCell(2).ToString().Trim();
                    empresa_rel = sheet.GetRow(i).GetCell(3).ToString().Trim();
                    operador    = sheet.GetRow(i).GetCell(4).ToString().Trim();
                    region      = sheet.GetRow(i).GetCell(5).ToString().Trim().PadLeft(2, '0');
                    ciudad      = sheet.GetRow(i).GetCell(6).ToString().Trim();

                    Hoja_1.Add(new Tuple <string, string, string, string, string, string, string>(zona, nombre, empresa, empresa_rel, operador, region, ciudad));
                }
                dgHoja.ItemsSource = Hoja_1;
                tab.Content        = dgHoja;
                tabControl.Items.Add(tab);
            }

            //HOJA 2
            {
                var zonaComer   = string.Empty;
                var empresa     = string.Empty;
                var empresa_rel = string.Empty;
                var pedido      = string.Empty;
                var entrega     = string.Empty;

                var sheet = wb.GetSheetAt(1);//primera hoja
                var tab   = new TabItem();
                tab.Header = sheet.SheetName;
                var dgHoja = new DataGrid();

                for (int i = 0; i <= sheet.LastRowNum; i++)
                {
                    zonaComer   = sheet.GetRow(i).GetCell(0).ToString().Trim();
                    empresa     = sheet.GetRow(i).GetCell(1).ToString().Trim().PadLeft(2, '0');
                    empresa_rel = sheet.GetRow(i).GetCell(2).ToString().Trim();
                    pedido      = sheet.GetRow(i).GetCell(3).ToString().Trim();
                    entrega     = sheet.GetRow(i).GetCell(4).ToString().Trim();

                    Hoja_2.Add(new Tuple <string, string, string, string, string>(zonaComer, empresa, empresa_rel, pedido, entrega));
                }
                dgHoja.ItemsSource = Hoja_2;
                tab.Content        = dgHoja;
                tabControl.Items.Add(tab);
            }

            //HOJA 3
            {
                var cliente     = string.Empty;
                var zonaComer   = string.Empty;
                var empresa     = string.Empty;
                var empresa_rel = string.Empty;

                var sheet = wb.GetSheetAt(2);//2da hoja
                var tab   = new TabItem();
                tab.Header = sheet.SheetName;
                var dgHoja = new DataGrid();

                for (int i = 0; i <= sheet.LastRowNum; i++)
                {
                    cliente     = sheet.GetRow(i).GetCell(0).ToString().Trim().PadLeft(5, '0');
                    zonaComer   = sheet.GetRow(i).GetCell(1).ToString().Trim();
                    empresa     = sheet.GetRow(i).GetCell(2).ToString().Trim();
                    empresa_rel = sheet.GetRow(i).GetCell(3).ToString().Trim();

                    Hoja_3.Add(new Tuple <string, string, string, string>(cliente, zonaComer, empresa, empresa_rel));
                }
                dgHoja.ItemsSource = Hoja_3;
                tab.Content        = dgHoja;
                tabControl.Items.Add(tab);
            }
        }