Syncfusion AI Assistant

How can I help you?

Getting Started with ASP.NET Core DOCX Editor

28 Apr 20263 minutes to read

Syncfusion® DOCX Editor (Document Editor) enables you to create, edit, view, and print Word documents in web applications. This section guides you through the steps to get started and create a DOCX Editor in a ASP.NET Core application.

Steps to create an ASP.NET Core DOCX Editor

This section briefly explains about how to include ASP.NET Core DOCX Editor control in your ASP.NET Core application using Visual Studio.

Prerequisites

System requirements for ASP.NET Core controls

Create ASP.NET Core web application with Razor pages

Create a new ASP.NET Core web application using one of the following methods:

Install Syncfusion® ASP.NET Core Nuget packages

To add ASP.NET Core Document Editor component in the application, follow the steps below.

  • open NuGet package manager in Visual Studio (Tools → NuGet Package Manager → Manage NuGet Packages for Solution),
  • search and install the following package

Alternatively, you can utilize the following package manager command to achieve the same.

Install-Package Syncfusion.EJ2.AspNet.Core -Version 33.2.3

NOTE

This package includes dependencies such as Newtonsoft.Json for JSON serialization and Syncfusion.Licensing for license validation.”

Add Syncfusion® ASP.NET Core Tag Helper

Open ~/Pages/_ViewImports.cshtml file and import the Syncfusion.EJ2 TagHelper.

@addTagHelper *, Syncfusion.EJ2

Add Themes and Script References

Here, the theme and script is referred using CDN inside the <head> of ~/Pages/Shared/_Layout.cshtml file as follows,

<head>
    ...
    <!-- Syncfusion ASP.NET Core controls styles -->
    <link rel="stylesheet" href="https://cdn.syncfusion.com/ej2/33.2.3/fluent.css" />
    <!-- Syncfusion ASP.NET Core controls scripts -->
    <script src="https://cdn.syncfusion.com/ej2/33.2.3/dist/ej2.min.js"></script>
</head>

NOTE

Refer the Themes topic to learn the different ways to include Syncfusion styles (using CDN, NPM package, or CRG) and ensure the expected appearance of Syncfusion® ASP.NET Core controls, and check the Adding Script Reference documentation to understand the various approaches for adding required script references in your ASP.NET Core application.

Register Syncfusion® Script Manager

Also, register the script manager <ejs-script> at the end of <body> in the ASP.NET Core application as follows.

<body>
    ...
    <!-- Syncfusion ASP.NET Core Script Manager -->
    <ejs-scripts></ejs-scripts>
</body>

Add the Syncfusion® Document Editor component

Add the Syncfusion® ASP.NET Core Document Editor tag helper in ~/Pages/Index.cshtml page.

<ejs-documenteditorcontainer id="container"></ejs-documenteditorcontainer>

Run the application

Press Ctrl+F5 (Windows) or +F5 (macOS) to run the app. Then, the Syncfusion® ASP.NET Core Document Editor control will be rendered in the default web browser.

ASP.NET Core DocumentEditor Control

NOTE

You can download a complete working sample from GitHub.