Docker Image Overview in React Spreadsheet component

16 Jul 20243 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 component. For more information on how to get started with the Spreadsheet component, refer to this getting started page.

import * as React from 'react';
import { createRoot } from 'react-dom/client';
import { SpreadsheetComponent } from '@syncfusion/ej2-react-spreadsheet';

function App() {

    return (
        // Initialize Spreadsheet component.
        <SpreadsheetComponent  openUrl='http://localhost:6002/api/spreadsheet/open' saveUrl='http://localhost:6002/api/spreadsheet/save' />
    );
};
export default App;

const root = createRoot(document.getElementById('root'));
root.render(<App />);

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 Javascript, Angular, Vue, ASP.NET Core, and ASP.NET MVC.