Docker Image Overview in EJ2 TypeScript Spreadsheet control

12 Jul 20244 minutes to read

The Syncfusion Spreadsheet (also known as Excel Viewer) is a feature-rich control for organizing and analyzing data in a tabular format. It provides all the common Excel features, including data binding, selection, editing, formatting, resizing, sorting, filtering, importing, and exporting Excel documents.

This Docker image is the pre-defined Docker container for Syncfusion’s Spreadsheet backend functionalities. This server-side Web API project targets ASP.NET Core 6.0.

You can deploy it quickly to your infrastructure. If you want to add new functionality or customize any existing functionalities, create your own Docker file by referencing the existing Spreadsheet Docker project.

The Spreadsheet is supported on the JavaScript, Angular, React, Vue, ASP.NET Core, and ASP.NET MVC platforms.

Prerequisites

Have Docker installed in your environment:

How to deploy the Spreadsheet Docker Image

Step 1: Pull the spreadsheet-server image from Docker Hub.

docker pull syncfusion/spreadsheet-server

Step 2: Create the docker-compose.yml file with the following code in your file system.

version: '3.4' 

services:
  spreadsheet-server:
    image: syncfusion/spreadsheet-server:latest
    environment:
      # Provide your license key for activation
      SYNCFUSION_LICENSE_KEY: YOUR_LICENSE_KEY
    ports:
      - "6002:80"

Note: The Spreadsheet is a commercial product. It requires a valid license key to use in a production environment. Please replace YOUR_LICENSE_KEY with the valid license key in the docker-compose.yml file.

Step 3: In a terminal tab, navigate to the directory where you’ve placed the docker-compose.yml file and execute the following:

docker-compose up

Now the Spreadsheet server Docker instance runs on localhost with the provided port number http://localhost:6002. Open this link in a browser and navigate to the Spreadsheet Web API open and save service at http://localhost:6002/api/spreadsheet/open and http://localhost:6002/api/spreadsheet/save.

Step 4: Append the URLs of the Docker instance running services to the openUrl property as http://localhost:6002/api/spreadsheet/open and the saveUrl property as http://localhost:6002/api/spreadsheet/save in the client-side Spreadsheet control. For more information on how to get started with the Spreadsheet control, refer to this getting started page.

<!DOCTYPE html>
<html lang="en">
<head>
    <title>Essential JS 2</title>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />
    <meta name="description" content="Essential JS 2" />
    <meta name="author" content="Syncfusion" />
    <link rel="shortcut icon" href="resources/favicon.ico" />
    <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" />
</head>
<body>
    <!--Element which will render as Spreadsheet-->
    <div id="Spreadsheet"></div>
</body>
</html>
import { Spreadsheet } from '@syncfusion/ej2-spreadsheet';

// Initialize Spreadsheet control
let spreadsheet: Spreadsheet = new Spreadsheet({
  openUrl: 'http://localhost:6002/api/spreadsheet/open',
  saveUrl: 'http://localhost:6002/api/spreadsheet/save'
});

// Render initialized Spreadsheet
spreadsheet.appendTo('#Spreadsheet');

How to configure different cultures using a Docker compose file

By default, the Spreadsheet Docker container is generated in the en_US culture. You can configure different cultures using the LC_ALL, LANGUAGE, and LANG environment variables in the docker-compose.yml file. These environment variables are replaced in the Docker file to set the specified culture for the Spreadsheet server.

version: '3.4' 

services:
  spreadsheet-server:
    image: syncfusion/spreadsheet-server:latest
    environment:
      # Provide your license key for activation
      SYNCFUSION_LICENSE_KEY: YOUR_LICENSE_KEY
      # Specify the culture to configure for the Spreadsheet server
      LC_ALL: de_DE.UTF-8
      LANGUAGE: de_DE.UTF-8
      LANG: de_DE.UTF-8
    ports:
      - "6002:80"

Please refer to these getting started pages to create a Spreadsheet in Angular, React, Vue, ASP.NET Core, and ASP.NET MVC.