Blog
All Blog Posts | Next Post | Previous PostFlexCel .NET, .NET5, Blazor and WebAssembly - Part 1
Wednesday, December 2, 2020
Introduction: Supporting .NET 5
We've just released FlexCel .NET 7.8, which adds support for .NET 5.
Usually, "adding support" for a new version of a .NET framework is just recompiling the code, but in this case, as .NET 5 is the successor of .NET Core 3, not of .NET framework 4.8, things got a little more complicated. There were subtle errors generated from the switch from NLS in Windows to ICU (see https://docs.microsoft.com/en-us/dotnet/standard/globalization-localization/globalization-icu ), and there were issues with the switching of the graphics engine from GDI+ to SKIA.
For this release we spent a lot of time optimizing the SKIA rendering, so it is now a little faster than GDI+. We added a way to switch back to GDI+ in Windows if you need to deal with WMF/EMF files or right-to-left languages (see https://doc.tmssoftware.com/flexcel/net/guides/net-core-guide.html ). We made a full review of all string comparisons in the code to ensure they work with ICU.
But this is all just business as usual. For this post, we wanted to have a little fun. And so we decided to investigate what cool stuff we can do with .NET 5 and FlexCel.
Generating a client-side app using Blazor and WebAssembly
Even if still a work in progress, one of the hot new things in .NET 5 is the improvements in Blazor, and more specifically, Blazor WebAssembly.
Blazor WebAssembly allows you to run a web app enterely on the browser, offline, in electron, and it even supports Progressive Web Applications
It made sense then to start with a small WebAssembly app using FlexCel .NET. But before getting into that and getting the hopes too high, I'd like to mention two limitations currently in Blazor WebAssembly:
- Blazor doesn't yet support AOT. This means that in order to compile to WebAssembly, Blazor currently has a .NET interpreter running in WebAssembly, and the interpreter runs .NET IL, not WebAssembly IL. FlexCel isn't directly converted to WebAssembly, but it rather runs in the browser as .NET IL. And because of there is no "real" FlexCel WebAssembly yet, it is not currently feasible to call FlexCel WebAssembly from TMS WEB Core
- The graphics engine we use for cross-platform rendering,(SkiaSharp), doesn't currently support Blazor WebAssembly, even if they are working on it. Not having SKIA means that you can't use the FlexCel rendering engine in WebAssembly, so you currently can't export an Excel file to PDF, SVG, or HTML in Blazor WebAssembly.Note that "Server Blazor", which runs native .NET 5 code in the server, doesn't have this limitation.
Both limitations should go away relatively soon, but we wanted to be completely honest about the current state. So now, with that out of the way, let's start. For this first example, we will create a Blazor WebAssembly "calculator" app that runs in the client and uses the FlexCel engine to calculate expressions
This was the first part of a 2-part series. In this one, we investigated client-side Blazor. In the next part, we will play a little with server-side Blazor.
Adrian Gallero
This blog post has not received any comments yet.
All Blog Posts | Next Post | Previous Post