反馈一个问题,给大量给Tag赋值,20W单元格,花费了35S,性能较差
var watch = new Stopwatch();
watch.Start();
var workbook = new GrapeCity.Documents.Excel.Workbook();
var currentSheet = workbook.Worksheets[0];
for (var i = 0; i < 15000; i++)
{
for (var j = 0; j < 13; j++)
{
var curCell = currentSheet.Range[i + 1, j];
curCell.Value = currentSheet.Rows[j];
//curCell.Tag = "222222222222222222222222";
curCell.Tag = $"{currentSheet.Name}|{i + 1}|{j}";
}
}
watch.Stop();
Console.WriteLine($"执行耗时:{watch.ElapsedMilliseconds}"); |