Comments (4)
So, Blazor server rendering is just one option. However the Blazor stack has a unified way of invoking JS commands, no matter where it is happening. Blazor handles registering the Javascript and triggering the iframe loading and what-not.
Blazor can also be exclusively front-end through WebAssembly where the execution context and interop are running in the same process.
The point being is that you don't need to worry about "How would the C# running in the service invoke the Excel.run in the iframe?" as the Blazor runtime already handles that for you.
There are already examples of how to use Office.js in Blazor, and most of those examples involve people still writing their own extensive Javascript and just invoking the JS methods from C#.
What I am suggesting is a native wrapper that would use a TypeScript to C# generator to re-create all of these objects in C#, and then leverage the Blazor JSInvoke infrastructure to translate these calls into invoked Javascript commands.
Since it has been done before, it is technically feasible. It would need a commitment from Microsoft and some budget to spend time on it.
Since WASM is the future of the web, I'm honestly surprised that Microsoft hasn't prioritized this more, because packaging Excel for the web as a WASM desktop app seems like a no-brainer.
from office-js.
Hi @robertmclaws -
Blazor is new to me, but I wanted to get your thoughts on how it would/could integrate with office.js. I'm starting with the top-level docs: https://learn.microsoft.com/en-us/aspnet/core/blazor/?view=aspnetcore-8.0&WT.mc_id=dotnet-35129-website
From my reading, the technology is server-rendered. This suggests the model would be that the manifest would point to an index.html that is rendered from a service owned by the add-in developer (eg: devserver.com/index.html). The implementation is in Blazor. So far so good.
The next hurdle is how and where office.js loads and runs vs where Blazor intends behavior to happen. The docs above say Blazor processes actions in the service. office.js needs to be present on the page in the iframe runtime of the host application. Suppose a user clicks a button to highlight the current selection.
The underlying code that needs to run is something like:
await Excel.run(context => {
const range = context.workbook.getSelectedRange();
range.format.fill.color = "yellow";
return context.sync();
});
This needs to run in the iframe though, because that's where we'd need to be able to post to the host from. From what I can tell, the point of Blazor is that the click would propagate back to the service and be processed by a C# handler, the page updated, and then sent back down and re-rendered.
How would the C# running in the service invoke the Excel.run in the iframe?
from office-js.
Closing as not planned - technical feasibility seems unlikely.
from office-js.
I agree this would be awesome!
from office-js.
Related Issues (20)
- Office.auth.getAccessToken not supported in Outlook add-ins HOT 3
- The onMessageRecipientsChangedHandler event does not get executed completely in Mac HOT 6
- Smart Alert Feature not working in Outlook Mac Thick Client HOT 11
- range.getDirectDependents should return dependent cell that refer as table columns HOT 4
- Attachments intermittently become locked on a message and cannot be deleted or previewed in new outlook HOT 16
- How to get image using Shape getAsImage for Dynamic Images HOT 5
- Enable and Disable Add-in Commands for Word Add-in HOT 6
- Custom function not working properly in Excel online HOT 12
- How to create a task or a resource with Office.js ? HOT 1
- Web add-in not loading in new Outlook windows version HOT 20
- [Word API] Document.compare: possible ways to obtain filePath for the documents to compare? HOT 10
- Outlook addin - is user always forced to click on the dialog to get a graph token? HOT 1
- Office.onReady() and Office.Initialize() get stuck/hangs intermittently in spam addins. HOT 7
- getSharedPropertiesAsync() not supported in New Look Outlook. HOT 4
- Incorrect Font Color Returned by MS Office API HOT 4
- Excel Add-in API functionality for storage, identity, and notes HOT 5
- Is there a way to read the format of individual characters in an Excel Cell? HOT 1
- Reading annotations throws error HOT 3
- How to access the currently displayed / rounded off value of a cell in Excel HOT 5
- [Outlook add-in] getCallbackTokenAsync failing to get Token HOT 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from office-js.