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?

Blazor
Blazor
A free and open-source web framework that enables developers to create web apps using C# and HTML being developed by Microsoft.
1,456 questions
Excel
Excel
A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
1,611 questions
Office Development
Office Development
Office: A suite of Microsoft productivity software that supports common business tasks, including word processing, email, presentations, and data management and analysis.Development: The process of researching, productizing, and refining new or existing technologies.
3,652 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Bruce (SqlWork.com) 59,131 Reputation points
    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