1金币
本帖最后由 Richard.Huang 于 2023-12-28 16:41 编辑
产品:GcExcel
版本:V4.2
代码如下:
- IWorkbook wk = new Workbook();
- wk.Options.Formulas.EnableIterativeCalculation = false;
- var json = File.ReadAllText("d:\\temp\\6fed6435-b289-45ce-aa32-57f42b535d4a.ssjson");
- wk.FromJson(json);
- Stopwatch stopwatch = new Stopwatch();
- for (int i = 0; i < 100; i++) {
- stopwatch.Start(); // 开始计时
- wk.DeferUpdateDirtyState = true;
- wk.Worksheets["去化及回款规则"].Range["L11"].Value = 0.33;
- // 执行需要监控性能的代码块
- wk.DeferUpdateDirtyState = false;
- Console.WriteLine($"Elapsed Time: {stopwatch.Elapsed}");
- stopwatch.Reset(); // 停止计时
- }
复制代码 越往后的写何解入性能越差,何解?
|
|