Adding Vuetify package to Excel addin made with VueJS framework - excel

I tried adding a excel add-in(Side load) using VueJS and created the manifest files by using Yeoman office package. I followed the instructions by going through this tutorial. Everything worked fine, now I wanted to add Vuetify framework to my add-in application.
On the main.js file from template, the Vue instance is initiated with this code
import Vue from 'vue'
import App from './App'
Vue.config.productionTip = false
const Office = window.Office
Office.initialize = () => {
new Vue({
el: '#app',
components: {App},
template: '<App/>'
})
}
}
Now I am trying to add Vuetify and doing an npm install as per their docs by modifying the above code as:
import Vue from 'vue'
import App from './App'
import Vuetify from 'vuetify'
Vue.use(Vuetify)
Vue.config.productionTip = false
const Office = window.Office
Office.initialize = () => {
new Vue({
el: '#app',
components: {App},
template: '<App/>'
})
}
When I introduce the Vuetify library, the add-in is not working..I am not sure how incorporate Vuetify to my Office add-in. Any help would be much appreciated. Thanks

I have uploaded an example repo with a Vue Excel addin using Vuetify:
https://github.com/beauholland/Vue-Excel-Addin
NPM install
NPM start
Browse to http://localhost:3000 and confirm the web app runs in IE11
If you get this far its time to sideload the app in Excel.
Setup sideload folder share for testing i.e. vue-excel\Graph API\ and configure Excel to trust share folder and insert addin https://learn.microsoft.com/en-us/office/dev/add-ins/testing/create-a-network-shared-folder-catalog-for-task-pane-and-content-add-ins
NOTE: the sample app in my repo is called "Graph API"

Recently got Vuetify working within an Excel Addin in Windows.
Are you on a Windows box?
Can you browse to your app i.e. http://localhost:3000 successfully?
Can you browse to your app i.e. http://localhost:3000 successfully within IE11?
Do you see any errors in your browser dev tools console?
What does "the add-in is not working" mean, any more specifics about the problem?
Issue I had was related to Vuetify IE11 compatibility, specifically...
Vuetify utilizes features of ES2015/2017 that require the need to use polyfills for Internet Explorer 11
Source: https://vuetifyjs.com/en/getting-started/quick-start#ie11-safari-9-support
As far as I am aware Excel addins require IE11 i.e. Office for Windows as at both 2013 and 2016 use an embedded IE11 instance to host add-ins.
Internet Explorer 11 or later, which must be installed but doesn't have to be the default browser. To support Office Add-ins, the Office client that acts as host uses browser components that are part of Internet Explorer 11 or later.
Source: https://learn.microsoft.com/en-us/office/dev/add-ins/concepts/requirements-for-running-office-add-ins
Source: https://officespdev.uservoice.com/forums/224641-feature-requests-and-feedback/suggestions/31155925-office-add-ins-should-run-in-edge-not-ie11

Related

How to add server-side database access to Nuxt app on Fly.io

I am trying to get started with Fly.io. I know Vue well and wanted to try Nuxt and Node.js. I cannot seem to figure out how to add server-side components and classes for handling AJAX requests.
I followed the official tutorial https://fly.io/docs/languages-and-frameworks/nuxtjs/
npm init nuxt-app#latest spec-land
create-nuxt-app v5.0.0
✨ Generating Nuxt.js project in spec-land
? Project name: spec-land
? Programming language: JavaScript
? Package manager: Npm
? UI framework: Element
? Template engine: HTML
? Nuxt.js modules: Axios - Promise based HTTP client
? Linting tools: (Press <space> to select, <a> to toggle all, <i> to invert selection)
? Testing framework: None
? Rendering mode: Single Page App
? Deployment target: Server (Node.js hosting)
? Development tools: jsconfig.json (Recommended for VS Code if you're not using typescript)
? What is your GitHub username? --
? Version control system: Git
🎉 Successfully created project spec-land
$ touch pages/index.js
$ npm run dev
After adding some front-end code, is this generated project equipped to run JavaScript on the server in the same fly.io deploy?
For a Nuxt2 app, you need to have Rendering Mode as Universal (SSR/SSG) or ssr: true in your nuxt.config.js file, otherwise, you will not have an isomorphic app.
Nuxt will run some code on the server side + client side (isomorphic), while some will be run only on the client side only.
The setup to have a serverMiddleware for Nuxt2 is as follows. Quite tricky and not working so well.
Nuxt3 handles that pretty well on the opposite side.
Overall, Nuxt2 does have some capabilities regarding server-side code but is not as flexible as Nuxt3. Tbh, if you want to use Nuxt2, I would recommend not trying to set up an actual database linked to it, but rather accessing it remotely via axios or like.

openapi.json not found when hosting NetCore 3.1 Web Api on IIS

I generated my server stub for ASP.NET Core 3.1 using the openapi generator with the following command:
npx #openapitools/openapi-generator-cli generate -i myapi.json -g aspnetcore -o C:\myapi --additional-properties aspnetCoreVersion=3.1
After opening that project in Visual Studio 2019 and running it I get the swagger page where I can try out the different endpoints. So far OK.
However: after publishing this on our IIS Server and visiting the proper URL that swagger page is loading with the error:
Not found: /swagger/1.0.0/openapi.json
Swagger error on IIS
The endpoint itself (GET request) can be reached.
The Swagger Endpoint code in startup.cs is the default code as it was generated by open-api generator:
app.UseSwagger(c =>
{
c.RouteTemplate = "swagger/{documentName}/openapi.json";
})
.UseSwaggerUI(c =>
{
//TODO: Either use the SwaggerGen generated Swagger contract (generated from C# classes)
c.SwaggerEndpoint("/swagger/1.0.0/openapi.json", "Swagger WP RUH Delivery");
//TODO: Or alternatively use the original Swagger contract that's included in the static files
// c.SwaggerEndpoint("/openapi-original.json", "Swagger WP RUH Delivery Original");
});
Why is this Swagger page working on my machine, but on IIS things go wrong?
I found some hints on changing the c.SwaggerEndpoint in startup.cs, but nothing helped.
Try to remove /swagger/ from the URL path:
c.SwaggerEndpoint("1.0.0/openapi.json", "Swagger WP RUH Delivery")

How to expose a module from an Electron app to an external module

I am creating an Electron app and am using electron-builder to package and build the app. Users are able to make plugins for the app (plugins can be node modules with their own dependencies and such). Everything is working fine except the part of the app for exposing the app's API to the plugin.
I created a module in the app for handling the plugins "Plugin-handler" that imports the plugin and also exposes the API to the plugin (The app's API is just a set of functions and it is bundled with the app).
The dilemma is that the user should be able to place a plugin anywhere on their machine and the app does not know the path before the build. Consequently, I excluded the "plugin-handler" module in the Electron-builder config so it does not bundle with the Webpack. Now I need to find the right way to expose the API to the plugin.
Here is how I am doing it now, to load the plugins and passing the API:
// In the Plugin-handler module
const API = require('api')
const plugin = require('path-to-plugin')( API )
path-to-plugin is added by the user in the app when they import their plugin.
As seen above, currently I pass the API to the plugin as an argument, which is not ideal, instead, I need a way to exposing the API module (or any other module that is bundled in the APP) to the plugin so users can access it in their plugin like below:
// In the plugin
const { arg1, arg2,... } = require('api')
I've seen apps doing this, and allowing users to access their API in their plugins, but since I am new to all this, I may be doing things wrong, so please do be kind, and thank you for the help!
I drew a simple chart for better portraying the question:

Office365 App for Excel Web: "Value cannot be null. Parameter name: conversationId"

I have developed an Office 365 app using MEAN-JS - ie Express and Node.js. It runs fine on Excel Desktop environment, but when running on Excel's Web App environment I am getting this error while the app is loading into the frame:
Sys.ArgumentNullException: Value cannot be null.
Parameter name: conversationId
File: excel-web-16.00.js, Line: 11, Column: 49669
From what I can research conversationId should be part of the API for mail apps, not Excel apps. So I am not sure why the Excel-Web-16.00.js API is looking for this parameter?
I've set up the test environment for Excel Web by loading the app manifest into an Office 365 Developer Sharepoint site, then running Excel Online and inserting the app.
Has anyone come across this before?
Thanks for your help.

Deployment of Node native modules to Azure WebSites

I'm trying to deploy the following sample node application to an Azure website:
var http = require('http');
var port = process.env.port || 1337;
http.createServer(function (req, res) {
res.writeHead(200, { 'Content-Type': 'text/html' });
try {
var canvasModule = require('canvas'),
canvas = new canvasModule(200, 200),
ctx = canvas.getContext('2d');
ctx.rotate(0.5);
ctx.font = '30px Impact';
var message = "Hello World";
ctx.fillText(message, 40, 40);
ctx.strokeRect(30, 5, 160, 50);
res.end('<html><img src="' + canvas.toDataURL() + '" /></html>');
} catch (e) {
res.end('Error: ' + e);
}
}).listen(port);
The tricky part is that I'm using a node module called "canvas" that needs to be compiled at install time using node-gyp.
According to this Microsoft page native modules are not supported on Azure Web-sites and the compiled version of the module should be copied to Azure for the app to work properly:
Native Modules
While most modules are simply plain-text JavaScript files, some
modules are platform-specific binary images. These modules are
compiled at install time, usually by using Python and node-gyp. One
specific limitation of Azure Web Sites is that while it natively
understands how to install modules specified in a package.json or
npm-shrinkwrap.json file, it does not provide Python or node-gyp and
cannot build native modules.
Since Azure Cloud Services rely on the node_modules folder being
deployed as part of the application, any native module included as
part of the installed modules should work in a cloud service as long
as it was installed and compiled on a Windows development system.
Native modules are not supported with Azure Web Sites. Some modules
such as JSDOM and MongoDB have optional native dependencies, and will
work with applications hosted in Azure Web Sites.
I deployed everything to Azure (using the publishing Wizard) and all the files were sent to Azure (apparently at least), including the compiled modules. When running the site on Azure I obtain the following exception:
Error: The specified module could not be found.
D:\home\site\wwwroot\node_modules\canvas\build\Release\canvas.node
But that file is in-fact deployed on the server:
Creating a VM would obviously be an option but I would prefer to use web-sites. Anyone has any idea that I can try out?
The error message ""The specified module could not be found" is a bit misleading. It can mean one or more dependent dlls are not found.
I assumed you used the build instruction in Windows. If you built canvas against the GTK2 zip file in the instruction, you can copy %GTKDIR%\bin\freetype6.dll to %YourApp%\node_modules\canvas\build\Release. This dll is not copied during the build process. You would need to do this deploying to a VM as well. Or you can build canvas against the Windows GTK3 bundle.
And unfortunately even after you have all the dll, the sandbox of Azure Websites seems to prevent canvas from running. Hopefully it would be enabled in the near future.
Alright got this working today!
You need to deploy your node_modules directory, in addition to that you need to copy all the contents gtk/bin to the root of your application, which makes it a bit messy, but it works. I imagine you could change the path to look elsewhere but I needed to get the app running so I didn't investigate any further.
That last line in #mtian's answser is key. You can spend time getting it to deploy but ultimately the Azure Website VMs lack the GDI+ APIs that node-canvas relies on to execute (presumably blocked for security considerations). If you want node-canvas on Azure, you can't use Azure Websites and will instead need to setup and manage your own VMs.

Resources