简体   繁体   English

Excel JavaScript API - 如何更改计算模式

[英]Excel JavaScript API - How to change calculation mode

This is my code: 这是我的代码:

Excel.Application.set({calculationMode: "Manual"});

But the compiler throws 但编译器抛出

TS2339: Property 'set' does not exist on type 'typeof Application'. TS2339:类型'typeof Application'上不存在属性'set'。

What is the api to change calculation mode? 改变计算模式的api是什么?

I think you just need to set the calculation mode in a context like in the following code. 我认为你只需要在上下文中设置计算模式,如下面的代码所示。

async function setCalculationMode() {
  await Excel.run(async (context) => {
    context.application.calculationMode = Excel.CalculationMode.manual;
    await context.sync();
  });
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM