Excel add-in in Angular featuring exclusive custom functions

I've recently embarked on the journey of developing Office Add-ins, using public code samples to simplify the process. Currently, I am exclusively testing with the web version of Excel.

My goal is to merge the functionality of two sample add-ins: one built with Angular framework using Typescript and another with custom functions using Typescript provided by yo office. Both samples work flawlessly when tested individually.

To achieve this, I took the .ts, .json, and .html files from the custom functions add-in and placed them in the task pane add-in folder. Subsequently, I merged the dependencies of both add-ins and edited the manifest.xml following the example of the AsyncStorage sample (https://github.com/OfficeDev/PnP-OfficeAddins/blob/master/Excel-custom-functions/AsyncStorage/).

Although the task pane works normally, the custom functions are not appearing as expected. Here's a snippet of my manifest.xml:

<!-- Inserted manifest.xml data here -->

What could be causing this issue?

Answer №1

If you execute 'npm start', the root folder of your web service will be located at 'https://localhost:3000'. However, it may not acknowledge the existence of the 'src' folder. In such cases, you must update all references containing '/src/' in their paths to a location within your output folder that is relative to the root of the web service.

To simplify the process for 'JSON-URL', 'JS-URL', 'HTML-URL', consider following these steps:

Firstly, run 'npm run build' on your custom functions project and transfer the files 'index.win32.bundle' (found in the 'dist/ship/win32' directory, representing the custom functions JavaScript) and 'customfunctions.json' directly from your separate custom functions project to the 'assets' folder of your integrated solution. Rename 'index.html' as 'customfunctions.html' to prevent confusion and also move this file to the assets folder. Subsequently, reference these files in the manifest as shown below:

<bt:Url id="JSON-URL" DefaultValue="https://localhost:3000/assets/customfunctions.json"/>
<bt:Url id="JS-URL" DefaultValue="https://localhost:3000/assets/index.win32.bundle"/>
<bt:Url id="HTML-URL" DefaultValue="https://localhost:3000/assets/customfunctions.html"/>   

While this may not be the definitive solution, it can serve as an effective starting point for your implementation.

Answer №2

After multiple attempts, I decided to start fresh by following a different example from https://github.com/OfficeDev/Excel-Custom-Functions, which included both task pane and custom functions. It finally appears to be functioning correctly, although I am still unsure about what the initial issue was. Below is my functional manifest.xml:

<?xml version="1.0" encoding="UTF-8"?>
<OfficeApp
          xmlns="http://schemas.microsoft.com/office/appforoffice/1.1"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xmlns:bt="http://schemas.microsoft.com/office/officeappbasictypes/1.0"
          xmlns:ov="http://schemas.microsoft.com/office/taskpaneappversionoverrides"
          xsi:type="TaskPaneApp">

  <!-- Begin Basic Settings: Add-in metadata, used for all versions of Office unless override provided. -->

  <!-- IMPORTANT! Id must be unique for your add-in, if you reuse this manifest ensure that you change this id to a new GUID. -->
  <Id>0decaece-0d07-4d70-ba89-c8e4d742f7f2</Id>

  <!--Version. Updates from the store only get triggered if there is a version change. -->
  <Version>1.0.0.0</Version>
  <ProviderName>[Provider name]</ProviderName>
  <DefaultLocale>en-US</DefaultLocale>
  <!-- The display name of your add-in. Used on the store and various places of the Office UI such as the add-ins dialog. -->
  <DisplayName DefaultValue="angular-cf" />
  <Description DefaultValue="[Workbook Add-in description]"/>

  <!-- Icon for your add-in. Used on installation screens and the add-ins dialog. -->
  <IconUrl DefaultValue="https://localhost:3000/assets/icon-32.png" />
  <HighResolutionIconUrl DefaultValue="https://localhost:3000/assets/hi-res-icon.png"/>

  <!--If you plan to submit this add-in to the Office Store, uncomment the SupportUrl element below-->
  <!--<SupportUrl DefaultValue="[Insert the URL of a page that provides support information for the app]">-->

  <!-- Domains that will be allowed when navigating. For example, if you use ShowTaskpane and then have an href link, navigation will only be allowed if the domain is on this list. -->
  <AppDomains>
    <AppDomain>AppDomain1</AppDomain>
    <AppDomain>AppDomain2</AppDomain>
    <AppDomain>AppDomain3</AppDomain>
    <AppDomain>contoso.com</AppDomain>
  </AppDomains>
  <!--End Basic Settings. -->

  <!--Begin TaskPane Mode integration. This section is used if there are no VersionOverrides or if the Office client version does not support add-in commands. -->
  <Hosts>
    <Host Name="Workbook" />
  </Hosts>
  <DefaultSettings>
    <SourceLocation DefaultValue="https://localhost:3000/index.html" />
  </DefaultSettings>
  <!-- End TaskPane Mode integration.  -->

  <Permissions>ReadWriteDocument</Permissions>

  <Requirements>
    <Sets DefaultMinVersion="1.1">
        <Set Name="CustomFunctionsRuntime" MinVersion="1.1"/>
    </Sets>
  </Requirements>  

  <!-- Begin Add-in Commands Mode integration. -->
  <VersionOverrides xmlns="http://schemas.microsoft.com/office/taskpaneappversionoverrides" xsi:type="VersionOverridesV1_0">

    <!-- The Hosts node is required. -->
    <Hosts>
      <!-- Each host can have a different set of commands. -->
      [...]
    </Hosts>

    <!-- You can use resources across hosts and form factors. -->
    <Resources>
      <bt:Images>
        [...]
      </bt:Images>
      <bt:Urls>
        [...]
      </bt:Urls>
      <!-- ShortStrings max characters==125. -->
      […]
    </Resources>
  </VersionOverrides>
  <!-- End Add-in Commands Mode integration. -->

</OfficeApp>

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Adding a Component in Ionic 3: Step-by-Step Guide

When I run this command: ionic generate component my-component It creates the following folder structure: components my-component my-component.ts my-component.scss my-component.html components.module.ts Now, I want to i ...

Alternatives to using wildcards in TypeScript

In my code, I have defined an interface called ColumnDef which consists of two methods: getValue that returns type C and getComponent which takes an input argument of type C. Everything is functioning properly as intended. interface ColumnDef<R, C> { ...

❴eslint_d❵ [eslint] Oops! It looks like there was an issue loading the 'import' plugin declared in your .eslintrc.js file

Recently, while using neovim for TypeScript development, I decided to upgrade eslint to version 8.28.0. However, upon opening neovim, I encountered an error. Despite several attempts to troubleshoot the issue, I have been unsuccessful in resolving it on my ...

Add the JavaScript files to the components

I am working on integrating an admin template into my Angular2 project (version 2.1.0) which is already equipped with Bootstrap, jQuery, and jQuery plugins. Since there are numerous jQuery plugins and JS files involved, I am faced with the challenge of ho ...

Issue with deprecated TypeORM connection and isConnected functions

import { Module } from '@nestjs/common'; import { Connection } from '../../node_modules/typeorm/connection/Connection'; import { TypeOrmModule } from '@nestjs/typeorm'; @Module({ imports: [TypeOrmModule.forRoot()], exports ...

The process of Angular Ahead-of-Time (AoT)

After reviewing the latest updates in Angular documentation, it seems that they have made significant changes to their approach. Previously, the process was as follows: Execute the ng eject command to generate webpack.config.js. Create webpack.config.aot ...

Ensuring the accuracy of nested objects through class validator in combination with nestjs

I'm currently facing an issue with validating nested objects using class-validator and NestJS. I attempted to follow this thread, where I utilized the @Type decorator from class-transform but unfortunately, it did not work as expected. Here is my setu ...

Invoking a function within an Angular component

I am facing a problem - is there a way to invoke a function from the name.component.html file without using a button click, and without needing to go through the .ts file or service? ...

Avoiding memory leaks in Angular2+ when using Subscribers and subscribe.first() can be challenging

Currently, I am enhancing the performance of an Angular2 app that runs on electron. My main goal is to reduce memory leaks in the application. I know that it is crucial to unsubscribe from observables when the app is destroyed to avoid them continually l ...

Checking an array of objects for validation using class-validator in Nest.js

I am working with NestJS and class-validator to validate an array of objects in the following format: [ {gameId: 1, numbers: [1, 2, 3, 5, 6]}, {gameId: 2, numbers: [5, 6, 3, 5, 8]} ] This is my resolver function: createBet(@Args('createBetInp ...

The Google Maps feature encountered an error (ReferenceError: google is not defined)

Utilizing the Google Maps API on my website to display multiple locations has been successful so far. However, an issue arises when attempting to determine the distance between two sets of latitude and longitude coordinates - resulting in an error message ...

What is the best way to make sure the background image adjusts to fit the browser window as it is resized?

Currently, I am working on creating a small responsive webpage that features a background image with several buttons placed on top of it. To set the background image, I included the following CSS: .background { height: 100vh; width: 100%; backg ...

Error encountered during unit testing: The function _reactRouterDom.useHistory.mockReturnValue is not a valid function

I'm having trouble writing unit tests for a React component implemented in TypeScript. I encountered an error when trying to mock some hook functions. Here is my current unit test implementation: import React from 'react'; import { useHisto ...

Trapped in a never-ending cycle caused by failing to dispatch an action within ngrx/effects

My current setup involves using Angular2, ngrx/store, and ngrx/effects for state management. I have encountered an issue where I am unable to display an error message when a specific action fails within an @Effects() block. Here is the problematic code sn ...

What is the best way to retrieve information from a dragged item in Material Design's drag and drop feature

Currently I am learning Angular and my first project involves creating a todo list application. I am using Node.js and MongoDB to develop it. The application has three containers: todos, doings, and dones. My challenge is handling the ID of an item when ...

Iterate through the complex array of nested objects and modify the values according to specified conditions

I am currently iterating through an array of objects and then delving into a deeply nested array of objects to search for a specific ID. Once the ID is found, I need to update the status to a particular value and return the entire updated array. Issue: Th ...

NG2-Charts are not rendering until the page is manually refreshed

I am currently working on an Angular project utilizing Angular 11. The issue I am encountering pertains to ng2-charts. Essentially, the chart is populated with data from an api-request call to the backend. I have identified where the problem lies, but I ...

Issue occurred while trying to render a React component with Typescript and WebPack

I am in the process of creating a basic React component that simply displays a page saying Hello. However, I'm encountering an error in my console. My compiler of choice is TypeScript. To set up my project, I am following this guide: https://github.co ...

Adding a click functionality to a dynamically generated anchor tag in angular.js

Recently, I encountered a requirement that involved converting a part of plain text into a clickable link and then adding a click handler to it. The goal was to display some details in a popup when the link is clicked. In order to convert the normal strin ...

An error occurred in the ngrx store with Angular during production build: TypeError - Unable to access property 'release' of undefined

After deploying my application and running it, I encountered an issue that seems to be happening only during production build at runtime. At this point, I am uncertain whether this is a bug or if there is a mistake in my code. The error "TypeError: Cannot ...