Пример #1
0
        private void OpenExcelFile()
        {
            //    if (encodingModel.EncodingTable.Columns.Count<1)
            //    {
            //        encodingModel.Status = "没有加载总表";
            //        return;
            //    }
            OpenFileDialog openFileDialog = new OpenFileDialog();

            if (openFileDialog.ShowDialog() == true)
            {
                ExcelPath = openFileDialog.FileName;
                var e = Path.GetExtension(ExcelPath);
                if (Path.GetExtension(ExcelPath) == ".xls" || Path.GetExtension(ExcelPath) == ".xlsx")
                {
                    encodingModel.Status       = Path.GetFileName(ExcelPath);
                    encodingModel.CurrentTable = NPOIServices.ExcelToDatatable(ExcelPath);

                    encodingModel.EncodingTable = encodingModel.CurrentTable;
                    encodingModel.CurrentCount  = encodingModel.CurrentTable.Rows.Count;
                }
                else
                {
                    encodingModel.Status = "不是有效的Excle文件";
                }
            }
        }
Пример #2
0
        private void GetTotalTable()
        {
            //  string path = @"\\192.168.0.17\记录表格\物料编码及规则\\仓库物料总表标准版.xls";
            string path = @"D:\仓库物料总表标准版.xls";

            encodingModel.EncodingTable = encodingModel.TotalTable = NPOIServices.ExcelToDatatable(path);
            encodingModel.Status        = "总表加载完成";
            encodingModel.TotalCount    = encodingModel.TotalTable.Rows.Count;
        }