View configuration
Load a document with Razor
The editor opens the invoice during server-side view rendering. Try editing it immediately, then compare the supported file formats in the Learn section.
Loaded before the browser connectsThe TextControl helper loads the file into the editor configuration, so no client-side request is required for the initial document.
Ready to tryUse the controls above to interact with this demo.
What this demonstrates
Loading from View
View-based loading is useful when the document is known while rendering the page, such as a template selected from a route, a user profile, or a server-side workflow.
Key members
Load a document in the view
TextControl.LoadText
Choose the document format
StreamType.InternalUnicodeFormat
How it works
The Razor helper calls LoadText before Render. The document is serialized into the editor configuration and appears as soon as the browser-side control is ready.
This approach is concise for documents stored on the server. For large files, user-driven selection, or documents that arrive after the page loads, use the controller or JavaScript loading patterns shown in the neighboring demos.
@Html.TXTextControl().TextControl(settings => {
settings.Dock = DockStyle.Fill;
}).LoadText(invoicePath,
StreamType.InternalUnicodeFormat)
.Render()
NuGet packages
TXTextControl.TextControl.Core.SDK
34.0.4
Provides the core document model and server-side document processing APIs.
dotnet add package TXTextControl.TextControl.Core.SDK --version 34.0.4
Provides the browser-based TX Text Control document editor and JavaScript API.
dotnet add package TXTextControl.Web --version 34.4.0
TXTextControl.Web.DocumentEditor.Backend
34.4.0
Hosts the WebSocket-based backend used by the browser document editor.
dotnet add package TXTextControl.Web.DocumentEditor.Backend --version 34.4.0
Source files
See the implementation
The view, browser behavior, and controller are encapsulated in Demos/RichTextEditor/DocumentManagement/FromView.