Blazor for Excel Web Add-in?

Fernando Magrina Ferreira 0 Reputation points
2024-06-11T17:53:54.11+00:00

Why there is no Blazor option to create Excel Web Add-ins?

Developer technologies .NET Blazor
Microsoft 365 and Office Development Other
Microsoft 365 and Office Excel For business Windows
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Bruce (SqlWork.com) 77,686 Reputation points Volunteer Moderator
    2024-06-11T18:48:42.77+00:00

    probably because while now technically feasible, the story isn't great. Only the UI is written in Blazor, all Excel interactions (api calls) are done in javascript. the javascript code can call static Blazor methods, and would be required to send any Excel data to Blazor. As the Excel api is promise based, this means Blazor can start an async operation, but not get the results (Blazor can not await a javascript promise). That is, all jsinterop to async javascript methods (an async function or function that returns a promise) is done with InvokeVoidAsync() the javascript needs to explicitly call back to Blazor static methods when complete:

    https://learn.microsoft.com/en-us/aspnet/core/blazor/javascript-interoperability/call-dotnet-from-javascript?view=aspnetcore-8.0

    here is a sample excel blazor addin:

    https://github.com/OfficeDev/Office-Add-in-samples/blob/main/Samples/blazor-add-in/excel-blazor-add-in/README.md

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.