How to use Aspose.Cells.GridWeb with .NET Core

Use Aspose.Cells.GridWeb with .NET Core

This topic shows how to use Aspose.Cells.GridWeb by making a sample website in Visual Studio 2019. The process has been divided into steps.

Step 1: Creating a New Project

  1. Open Visual Studio 2019.
  2. From the File menu, select New, then Project. The Create a new project dialog opens.
  3. Select ASP.NET Core Web Application from Visual Studio’s installed project templates and click Next.

todo:image_alt_text

  1. Specify the location and name of the project, then click Create.

todo:image_alt_text

  1. Select the Web Application (Model-View-Controller) template and make sure that ASP.NET Core 2.1 is selected.

todo:image_alt_text

  1. Click Create.

Step 2: Checking the initial view

Running the newly created project shows the default template in the browser as shown in the image below.

todo:image_alt_text

Step 3: Adding Aspose.Cells.GridWeb

  1. Add the following NuGet packages to the project
<PackageReference Include="Microsoft.AspNetCore.App" />
<PackageReference Include="Microsoft.AspNetCore.Razor.Design" Version="2.1.2" PrivateAssets="All" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="System.Drawing.Common" Version="4.7.0" />
<PackageReference Include="System.Text.Encoding.CodePages" Version="4.7.0" />
  1. Add the Aspose.Cells.GridWeb package

todo:image_alt_text

  1. Add the following to the _ViewImports.cshtml file in the Views folder.

The file will look like this after the modifications:

todo:image_alt_text

  1. Put the following code in the HomeController’s Index method.

todo:image_alt_text

  1. Add the following code in the Index.cshtml file in the Views > Home directory.

The file will look like this after the change:

todo:image_alt_text

  1. Add session support and the GridScheduledService in the Startup.cs file
    1. Add the following code snippet in the ConfigureServices method.

todo:image_alt_text

  1. Add the following code snippet in the Configure method.

todo:image_alt_text

  1. Put the latest acw_client in the directory wwwroot/js.
  1. Add an AcwController in the Controllers folder to handle the acw route, which provides the default operations for general edit actions.

todo:image_alt_text

Step 4: Test the App

Running the app will produce output similar to the one shown in the image below.

todo:image_alt_text