public static List <ExcelStateObj> ReadExcel(string path)
        {
            MemoryStream         memory      = new MemoryStream(LoadFilebytes(path));
            List <ExcelStateObj> list        = new List <ExcelStateObj>();
            IExcelDataReader     excelReader = ExcelReaderFactory.CreateOpenXmlReader(memory);

            do
            {
                // sheet name
                //Debug.Log(excelReader.Name);
                List <RowStateObj> rowList = new List <RowStateObj>();
                int rowCount = 0;
                int colCount = 0;
                while (excelReader.Read())
                {
                    bool        isAdd = false;
                    RowStateObj row   = new RowStateObj(excelReader.FieldCount);
                    colCount = Mathf.Max(excelReader.FieldCount, colCount);
                    for (int i = 0; i < colCount; i++)
                    {
                        CellStateObj cell = new CellStateObj();
                        row.Cells[i] = cell;
                        if (i < excelReader.FieldCount)
                        {
                            string value = excelReader.IsDBNull(i) ? "" : excelReader.GetString(i);
                            cell.Value = value;
                            if (!string.IsNullOrEmpty(value))
                            {
                                isAdd = true;
                            }
                        }
                    }
                    if (isAdd)
                    {
                        rowCount++;
                        rowList.Add(row);
                    }
                }
                ExcelStateObj excelStateObj = new ExcelStateObj(rowCount, colCount);
                excelStateObj.ExcelName = excelReader.Name;
                excelStateObj.Rows      = rowList.ToArray();
                list.Add(excelStateObj);
            }while(excelReader.NextResult());
            //DataSet result = excelReader.AsDataSet();
            excelReader.Close();
            excelReader.Dispose();
            memory.Close();
            memory.Dispose();
            return(list);
        }
        private void DrawRow(RowStateObj row)
        {
            if (row == null)
            {
                return;
            }
            float wid = position.width;

            EditorGUILayout.BeginHorizontal();
            row.CanExport = EditorGUILayout.Toggle(row.CanExport, GUILayout.MinWidth(0), GUILayout.MaxWidth(wid / (row.CellCount + 1 - row.StartCol)));
            for (int i = row.StartCol; i < row.CellCount; i++)
            {
                CellStateObj cell   = row.Cells[i];
                string       _value = cell == null || string.IsNullOrEmpty(cell.Value) ? "" : cell.Value;
                EditorGUILayout.LabelField(_value, GUILayout.MinWidth(0), GUILayout.MaxWidth(wid / (row.CellCount + 1 - row.StartCol)));
            }
            EditorGUILayout.EndHorizontal();
        }
        private void DrawTable()
        {
            ExcelStateObj table = selectTable;

            if (table == null)
            {
                return;
            }
            if (table.modelDict == null)
            {
                table.modelDict = new Dictionary <int, int>();
            }
            if (table.ColunmModel == null)
            {
                return;
            }
            float wid      = position.width;
            int   StartRow = table.StartRow;

            EditorGUILayout.BeginHorizontal();
            GUILayout.Label("Start Row:", GUILayout.MinWidth(0), GUILayout.MaxWidth(wid / 4));
            StartRow = EditorGUILayout.IntField(table.StartRow, GUILayout.MinWidth(0), GUILayout.MaxWidth(wid / 4));
            int StartCol = table.StartCol;

            GUILayout.Label("Start Colunm:", GUILayout.MinWidth(0), GUILayout.MaxWidth(wid / 4));
            StartCol = EditorGUILayout.IntField(table.StartCol, GUILayout.MinWidth(0), GUILayout.MaxWidth(wid / 4));

            if (StartRow != table.StartRow)
            {
                table.StartRow = StartRow;
            }
            if (StartCol != table.StartCol)
            {
                table.StartCol = StartCol;
            }
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("", GUILayout.MinWidth(0), GUILayout.MaxWidth(wid / (table.ColCount + 1 - table.StartCol)));
            RowStateObj row = table.Rows[0];

            for (int j = table.StartCol; j < table.ColCount; j++)
            {
                CellStateObj cell = row.Cells[j];
                EditorGUILayout.LabelField(cell.Value, GUILayout.MinWidth(0), GUILayout.MaxWidth(wid / (table.ColCount + 1 - table.StartCol)));
            }
            EditorGUILayout.EndHorizontal();
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("", GUILayout.MinWidth(0), GUILayout.MaxWidth(wid / (table.ColCount + 1 - table.StartCol)));
            for (int j = table.StartCol; j < table.ColCount; j++)
            {
                if (!table.modelDict.ContainsKey(j))
                {
                    table.modelDict[j] = 0;
                }
                int isShow = table.modelDict[j];
                isShow = EditorGUILayout.Popup(isShow, table.ColunmModel, GUILayout.MinWidth(0), GUILayout.MaxWidth(wid / (table.ColCount + 1 - table.StartCol)));
                if (isShow != table.modelDict[j])
                {
                    if (isShow != 0)
                    {
                        table.SetExportColunmExport(j, true);
                        table.SetExportColunmName(j, table.ColunmModel[isShow]);
                    }
                    else
                    {
                        table.SetExportColunmExport(j, false);
                    }
                }

                table.modelDict[j] = isShow;
            }
            EditorGUILayout.EndHorizontal();
            EditorGUILayout.BeginVertical();
            _scrollPos = EditorGUILayout.BeginScrollView(_scrollPos);

            for (int i = table.StartRow; i < table.RowCount; i++)
            {
                RowStateObj _row = table.Rows[i];
                DrawRow(_row);
            }
            EditorGUILayout.EndVertical();
            EditorGUILayout.EndScrollView();
        }