Muruga ananth
Muruga ananth

Reputation: 89

Office add-in requirements

Is Yeoman generator mandatory for office add-in? Can you please confirm.Since we are trying only with VS code and nodejs

We tried with only VS code for debugging office Excel add-in sample but getting below error. Reference Error: Office is not defined.

Upvotes: 0

Views: 208

Answers (2)

Ragavan Rajan
Ragavan Rajan

Reputation: 4397

The straight answer is No and Not Mandatory.

As mentioned by @adamk Yeoman generator comes with the following features

  1. Modified Webpack
  2. Debugger
  3. Office Manifest Validator and so on

If you are receiving Office is not defined error

under dependecies aka package.json in most cases. Make sure you import the types from Office JS

"@types/office-js": "^1.0.23",

And remember in your Index.html you should definitely call the Office JS API via CDN

    <!-- Office JavaScript API -->
    <script
        type="text/javascript"
        src="https://appsforoffice.microsoft.com/lib/1.1/hosted/office.js"
    ></script>

Note: Adding CDN is mandatory because only if you have CDN reference then MSFT will allow you to publish your Add-in to App Source.

Hope it helps

Upvotes: 0

adamk
adamk

Reputation: 124

Yo Office is the tool to get started with a Office Add-in project easily, but it is not mandatory.

For Excel debugging, it matters whether you are using Excel Desktop or Excel in a web browser. It also matters whether the code is for Excel Custom Functions which uses a different runtime in Excel Desktop from the other parts of the add-in which run in a webview.

For Excel in a web browser, you use the browser dev tools to debug.

In order to debug Excel Custom Functions in the desktop, support is provided by the office-addin-debugging package to perform the necessary steps to configure debugging and launch Excel. You could set this up for your own project based on the Yo Office template. Let me know if that is what you are trying to do.

For the other parts of the add-in running in the Excel Desktop webview, you need to use Visual Studio. (You can also use the Edge DevTools if the Edge WebView is being used, or F12 DevTools for Internet Explorer WebView.)

Upvotes: 1

Related Questions