Blazor Applications
Blazor Server and Blazor WebAssembly show the editor with the component of the package TXTextControl.TXSheetControl.Blazor. In both hosting models the editor runs in the browser, and the package brings its script and its fonts as static web assets. dotnet publish copies them into the output. The hosting models differ in how the files are served and in where the license ends up.
Publish the Applications
dotnet publish SheetServer/SheetServer.csproj Release publish/server
dotnet publish SheetClient/SheetClient.csproj Release publish/client
Deploy the complete output. It contains the package files in wwwroot/_content/TXTextControl.TXSheetControl.Blazor/: the script tx-sheet-control-blazor.js, fonts/ with the catalog and the fonts, languages/ and licenses/. The component loads the script after interactive rendering has started, and the script loads the fonts from the same folder. No CDN, no font service and no Server package is required for the editor.
- Blazor Server runs as an ASP.NET Core application with interactive Server rendering, and serves the files with its static file middleware.
- Blazor WebAssembly publishes static files in
publish/client/wwwroot. Any web server can host them; it must answer unknown paths withindex.html, so that links into the application work, and serve.wasmfiles asapplication/wasm. The assemblies of the package,TXTextControl.TXSheetControl.BlazorandTXTextControl.TXSheetControl.Api, are in_frameworkas.wasmfiles.
When the application runs below a path, such as /reports/, set the <base href="/reports/"> of the page, so that the component resolves its files below that path.
The License in WebAssembly
Pass the license in SheetControlOptions.License. A WebAssembly application runs entirely in the browser, so the license is part of the files it publishes, for example in wwwroot/appsettings.json and its compressed copies .br and .gz. That is expected: the browser editor needs the license, as Licensing explains. Keep other secrets, such as the credentials of your backend, out of the files of a WebAssembly application.
Server Circuits
In Blazor Server, every call of the C# API travels over the circuit between server and browser. Use range operations such as Range.SetValuesAsync and Workbook.BatchAsync to combine changes into fewer calls. When the application transfers large workbooks as JSON, raise the message size limit of the circuit:
builder.Services.AddRazorComponents()
.AddInteractiveServerComponents()
.AddHubOptions(options => options.MaximumReceiveMessageSize = 32 * 1024 * 1024);
Choose the limit for your documents and network. Saved files, such as PDF and XLSX, return as byte arrays through Blazor streaming, and LoadAsync from a stream accepts up to 128 MiB.
Add Backend Processing
The component processes documents in the browser. For processing on the server, add the Server package: in Blazor Server to the same project, in Blazor WebAssembly to the API or hosting project. Transfer the saved bytes, such as TXWB or XLSX, between the editor and the server control explicitly; they do not share a workbook. Choose a Package shows which project needs which package, and .NET Server Applications how to deploy it.
Verify the Published Application
- The editor reaches
Ready, and the browser loadstx-sheet-control-blazor.jsand the fonts from_content/TXTextControl.TXSheetControl.Blazor/without errors. - Formulas recalculate after editing, and the events of the component arrive.
- An XLSX file loads and saves with its data, and a PDF export contains the expected fonts.
- Removing and recreating the component works, and an invalid license reaches your
Errorcallback.
Next Steps
- Blazor tutorial: build a first Blazor application with the editor.
- Install the NuGet Packages: the packages of each project.
- Host Security and File Handling: what the host application controls.