Products Technologies Demo Docs Blog Support Company

Using the Document Editor in an ASP.NET Core React Application

This article shows how to use the Document Editor in an ASP.NET Core React application. The Document Editor is a fully featured word processing component that can be used to create, edit, modify and print documents.

Using the Document Editor in an ASP.NET Core React Application

Prerequisites

In order to create a backend application, TX Text Control .NET Server must be installed on your machine. When deploying this backend application, refer to the documentation to learn how to install the required TCP Service:

Creating the Project

The following tutorial will show you how to create an React and ASP.NET Core application that the required backend middleware and uses the official TX Text Control Document Editor React component.

  1. In Visual Studio 2022, create a new project, select React and ASP.NET Core as the project template and continue with Next.

    Creating the application

  2. Select a project name, location and solution name in the next dialog and confirm with Next.

  3. In the last dialog, select .NET 8 (Long Term Support) as the Framework and confirm with Create.

    ASP.NET Core Web Application

Adding NuGet Packages

  1. In the Solution Explorer, select the created project that ends with .Server and choose Manage NuGet Packages... from the Project main menu.

    Select Text Control Offline Packages from the Package source drop-down.

    Install the latest versions of the following package:

    • TXTextControl.Web

    ASP.NET Core Web Application

Adding the Middleware

  1. Open the Program.cs file located in the project's root folder. Replace the content with the following code:

    using TXTextControl.Web;
    
    var builder = WebApplication.CreateBuilder(args);
    
    // Add services to the container.
    
    builder.Services.AddControllersWithViews();
    
    var app = builder.Build();
    
    app.UseDefaultFiles();
    app.UseStaticFiles();
    
    // Configure the HTTP request pipeline.
    
    app.UseHttpsRedirection();
    
    app.UseWebSockets();
    app.UseTXWebSocketMiddleware();
    
    app.MapFallbackToFile("/index.html");
    
    app.Run();

Adding the React Component

  1. In the Solution Explorer, right-click npm in the project node that ends with .client and select Install new npm packages from the context menu.

  2. In the opened dialog, search for @txtextcontrol/tx-react-document-editor and install the package.

    TX Text Control npm packages

Adding the Component

  1. Open the App.jsx file located in the src folder. Replace the content with the following code:

  2. Be sure to replace the port number (7066 in this example) with the port number of your hosting application. You can find this port number in the launchSettings.json file of your server application.

    ASP.NET Core Web Application

    Also make sure to set the launchUrl to an empty string.

  1. Compile and start the application.

Stay in the loop!

Subscribe to the newsletter to receive the latest updates.

ASP.NET

Integrate document processing into your applications to create documents such as PDFs and MS Word documents, including client-side document editing, viewing, and electronic signatures.

ASP.NET Core
Angular
Blazor
JavaScript
React
  • Angular
  • Blazor
  • React
  • JavaScript
  • ASP.NET MVC, ASP.NET Core, and WebForms

Learn more Trial token Download trial

Related Posts

AngularASP.NETJavaScript

Building an ASP.NET Core Backend Application to Host the Document Editor and…

This article explains how to create an ASP.NET Core backend application to host the Document Editor and Document Viewer. This backend application is required to provide the required functionality…


ASP.NETReactDocument Editor

TX Text Control React Packages Released

We are very happy to announce the immediate availability of React packages for TX Text Control. The new packages are available on npm and provide a wide range of document processing features…


ASP.NETASP.NET CoreDocument Editor

Getting Started Video Tutorial: Document Editor in ASP.NET Core C# on Linux

This video tutorial shows how to use the Document Editor in an ASP.NET Core application using C# and deploy on Linux using Docker. This tutorial is part of the TX Text Control Getting Started…


ASP.NETDocument EditorDocument Protection

Document Protection in ASP.NET with TX Text Control: Healthcare Use Cases

This article explores document protection use cases in the healthcare domain. It also explains how to assign usernames, configure edit modes, and use editable regions based on user roles using the…


ASP.NETApp ServicesASP.NET Core

Deploying the TX Text Control Document Editor in an ASP.NET Core Web App to…

This tutorial shows how to deploy the TX Text Control Document Editor to Azure App Services using an ASP.NET Core Web App. The Document Editor is a powerful word processing component that can be…