Пример #1
0
        private async void btnView_Click(object sender, EventArgs e)
        {
            Excel.Worksheet sheet = (Excel.Worksheet)_sheets[view.SelectedSheet];
            if (sheet == null)
            {
                return;
            }
            view.EndColumnName = ExcelLimits.GetEndColumnName(view.EndColumnName);
            var endColName = view.EndColumnName;

            stopwatch.Restart();
            SetDataReadState(string.Empty);
            var data = await Task.Factory.StartNew(() => WorksheetHelper.GetRowContent(sheet, view.DataRowIndex, endColName));

            stopwatch.Stop();
            var dataElapsed = stopwatch.Elapsed;

            stopwatch.Start();
            ShowData(data, dataGridView);
            stopwatch.Stop();
            var desc = $"总计行数:{data.Count},数据解析耗时:{dataElapsed},总计耗时:{stopwatch.Elapsed}";

            SetDataReadState(desc);
        }