Syncfusion AI Assistant

How can I help you?

Getting Started with ASP.NET Core DOCX Editor

26 May 20263 minutes to read

Syncfusion® ASP.NET Core 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 how to include Document 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 the following method:

Install Document Editor NuGet packages

To add 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 ~/Views/_ViewImports.cshtml file and import the Syncfusion.EJ2 TagHelper.

@addTagHelper *, Syncfusion.EJ2

Add Themes and Script References

Here, the theme and scripts are referenced using CDN inside the <head> of ~/Views/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-scripts> at the end of <body> in the ~/Views/Shared/_Layout.cshtml file as follows.

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

Add the Document Editor component

Add the Document Editor tag helper in ~/Views/Home/Index.cshtml page.

<ejs-documenteditorcontainer id="container" height="620px"></ejs-documenteditorcontainer>

Run the application

Press Ctrl+F5 (Windows) or +F5 (macOS) to run the app. Then, the Document Editor control will be rendered in the default web browser as shown below.

Output of ASP.NET Core DOCX Editor

NOTE

View Sample in GitHub.

See also