Home > front end >  How to create custom function in excel add-in using office JS in already existing react project
How to create custom function in excel add-in using office JS in already existing react project

Time:01-18

I am new to a custom function. I already have a react project. I want to use one custom function in that project. I have read the document about it. It has two options either you can create a react js project or you can create custom function project.

can anyone guide me on "how to create a custom function in react project"?

CodePudding user response:

Yadav, here is one option:

  1. Generate a new add-in project using the yo office "Excel Custom Functions using a Shared Runtime" template.
  2. Compare the following files with what you already have in your add-in project to identify the changes you need to make to add custom functions to your project: manifest.xaml, package.json, webpack.config.js.
  3. Copy new files that identified in step 2 from the project you made in step 1 to your add-in project.
  4. Make the changes identified in step 2.

CodePudding user response:

Office add-ins that combine two kind of features - custom functions and, for example, react web app are run all of its code in a single shared runtime. A shared runtime isn't a type of runtime. It refers to a browser-type runtime that's being shared by features of the add-in that would otherwise each have their own runtime. Specifically, you have the option of configuring the add-in's task pane and function commands to share a runtime. In an Excel add-in, you can configure custom functions to share the runtime of a task pane or function command or both. When you do this, the custom functions are running in a browser-type runtime, instead of a JavaScript-only runtime as it otherwise would.

See Configure your add-in to use a shared runtime for information about the benefits and limitations of sharing runtimes and instructions for configuring the add-in to use a shared runtime. In brief, the JavaScript-only runtime uses less memory and starts up faster, but has fewer features.

  • Related