Spire.Cloud.Office is a HTML5-based document editor that allows users to view and edit Word and Excel documents in a web browser. After installing it on your server, you'll be able to embed the editor in your own web application. This article will show you how to install Spire.Cloud.Office for Linux on CentOS 7 via Docker.

Step 1. Pull Spire.Cloud.Office Docker Image

Run the script docker pull eiceblue/centos7:spire to pull the image of Spire.Cloud.Office from the docker repository.

Install Spire.Cloud.Office for Linux on CentOS via Docker

Step 2. Create a Docker Container

Create a docker container named "spirecloud" (or whatever name you like) by executing the script docker run -itd --privileged --name spirecloud -e IP_ADDR="xxx.xxx.xxx.xxx" -p 3000:3000 -p 8000:8000 -p 8050:8050 eiceblue/centos7:spire /usr/sbin/init. Don't forget to specify the IP address and the ports according to your usage scenario.

Install Spire.Cloud.Office for Linux on CentOS via Docker

Step 3. Copy License to CentOS

Here, we use WinSCP to copy files from Windows to the root of CentOS system.

1) Log in to WinSCP.

Install Spire.Cloud.Office for Linux on CentOS via Docker

2) Copy the license file to the /root/license/ directory.

Install Spire.Cloud.Office for Linux on CentOS via Docker

Step 4. Copy License from Root to Docker

Run the script docker cp /root/license/license.elic.xml spirecloud:/opt/spire/spire.cloud/service/ConverterService/bin/license to copy the license file from root to the docker container.

Install Spire.Cloud.Office for Linux on CentOS via Docker

Step 5. Bind License

Execute the following commands successively to bind the license.

- docker exec -it spirecloud /bin/bash
- cd opt/spire
- sh binding_license.sh

Install Spire.Cloud.Office for Linux on CentOS via Docker

Now that you've successfully installed Spire.Cloud.Office for Linux on CentOS, you can visit our example on port 3000, and embed the document editor in your HTML page using JavaScript.

Install Spire.Cloud.Office for Linux on CentOS via Docker

Published in Getting Started

Spire.Cloud.Office is a HTML5-based document editor that allows users to view and edit Word and Excel documents in a web browser. After installing it on your server, you'll be able to embed the editor in your own web application. This article will show you how to install Spire.Cloud.Office for Linux on CentOS 7.

Step 1. Configure the Environment

1) Turn off the firewall

Run the script firewall-cmd --state as root to view the firewall status. If the status is "not running", no other settings required; if the status is "running", run the script systemctl stop firewalld.service to shut down the firewall.

Install Spire.Cloud.Office for Linux on CentOS

2) Configure a static IP

Run the script vi /etc/sysconfig/network-scripts/ifcfg-ens32 (ens32 can be replaced by your network name) to open the network configuration file to configure a static IP address.

Press I to enter the editing mode, change the value of BOOSPROTO to "static", and add IP address, net mask, gateway, and DNS server at the end. After edits are completed, press Esc and then enter the script :wq to save the changes and exit.

Install Spire.Cloud.Office for Linux on CentOS

Enter the script systemctl restart network to restart the network service, and then run the script ip addr to check whether the IP address has been successfully applied.

Install Spire.Cloud.Office for Linux on CentOS

Step 2. Copy Spire.Cloud.Office to CentOS

Download Spire.Cloud.Office for Linux package, and unzip it somewhere on your disk. We use WinSCP to copy files from Windows system to the root of CentOS system.

1) Log in to WinSCP

Install Spire.Cloud.Office for Linux on CentOS

2) Copy files

After the connection is successful, copy the files contained in Spire.Cloud.Office for Linux package to the /root/cloud/ directory of the CentOS system. The "cloud" folder here is a newly created folder and can be named arbitrarily.

Install Spire.Cloud.Office for Linux on CentOS

Step 3. Install Spire.Cloud.Office for Linux

Enter the folder where the file "install_centos7.sh" is located, then run the script sh install_centos7.sh to install Spire.Cloud.Office on CentOS.

Install Spire.Cloud.Office for Linux on CentOS

After the installation is completed, you'll get the following output.

Install Spire.Cloud.Office for Linux on CentOS

Step 4. Bind License

Copy your license file to the /root/cloud/spire.cloud/service/ConverterService/bin/license/ directory through WinSCP. If you need a temporary license to evaluate our product, please contact sales.

Install Spire.Cloud.Office for Linux on CentOS

Enter the folder that contains the file "binding_license.sh", then run the script sh binding_license.sh to bind the license.

Install Spire.Cloud.Office for Linux on CentOS

After the license is successfully bound, you'll get the following output.

Install Spire.Cloud.Office for Linux on CentOS

Now that you've successfully installed Spire.Cloud.Office for Linux on CentOS, you can visit our example on port 3000, and embed the document editor in your HTML page using JavaScript.

Install Spire.Cloud.Office for Linux on CentOS

Published in Getting Started

Spire.Cloud.Office is a JavaScript document editor which you can use to create, edit, convert, print, view and save MS Word and Excel documents in a browser on Windows, Linux and Mac. This article demonstrates how to incorporate Spire.Cloud.Office online editor (JavaScript) into a HTML document, so you can run the editor directly in your web application or cloud application.

Step 1. Install Spire.Cloud.Office

Before you can embed the document editor in your HTML file, you’ll need to install Spire.Cloud.Office on your system.

After installation, you can visit our sample file management system and editor on port 3000, and connect to our service via port 8000. In this tutorial, Spire.Cloud.Office is installed on our local server 192.168.0.111.

Step 2. Embed Editor in Your HTML Document

Below is a sample HTML in which our document editor is embedded. You can download it and modify some key parameters in it to run our editor in a HTML page.

<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><link rel="icon" href="https://cdn.e-iceblue.com/favicon.ico" type="image/x-icon" /><title>
	Spire.Office
</title>

    <style>
        html {
            height: 100%;
            width: 100%;
        }

        body {
            background: #fff;
            color: #333;
            font-family: Arial, Tahoma,sans-serif;
            font-size: 12px;
            font-weight: normal;
            height: 100%;
            margin: 0;
            overflow-y: hidden;
            padding: 0;
            text-decoration: none;
        }

        form {
            height: 100%;
        }

        div {
            margin: 0;
            padding: 0;
        }
    </style>

    <script language="javascript" type="text/javascript" src="http://192.168.4.77:8000/web/editors/spireapi/SpireCloudEditor.js"></script>

    <script type="text/javascript" language="javascript">

        var docEditor;
        var fileName = "";
        var lang = "zh";
        var fileType = "";
        var token = null;
        var appid = null;
        var appkey = null;

        var innerAlert = function (message) {
            if (console && console.log)
                console.log(message);
        };

        var onStart = function () {
            innerAlert("Document editor ready");

        };

        var onDocumentStateChange = function (event) {
            var title = document.title.replace(/\*$/g, "");
            document.title = title + (event.data ? "*" : "");
        };

        var onRequestEditRights = function () {
            location.href = location.href.replace(RegExp("action=view\&?", "i"), "");
        };

        var onError = function (event) {
            if (event)
                innerAlert(event.data);
        };

        var onOutdatedVersion = function (event) {
            location.reload(true);
        };
        function ajax(options) {
            options = options || {};
            var method = (options.type || "GET").toUpperCase(),
                url = options.url,
                queryString = null;
            if (!url)
                return;
            if (options.data) {
                queryString = [];
                for (var attr in options.data) {
                    queryString.push(attr + "=" + options.data[attr]);
                }
                queryString = queryString.join("&");
            }
            if (method === "GET" && queryString) {
                url += "?" + queryString;
                queryString = "";
            }
            var xhr = new XMLHttpRequest();
            xhr.open(method, url, true);
            if (method === "POST")
                xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
            xhr.send(queryString);
            xhr.onreadystatechange = function () {
                if (xhr.readyState === 4) {
                    if (xhr.status === 200) {
                        var data = xhr.responseText;
                        if (options.dataType === "json")
                            data = JSON.parse(data);
                        options.success && options.success(data);
                    } else {
                        options.error && options.error(xhr.status);
                    }
                }
            }
        }
        var callbackfn = function (result) {
            if (result && result.data) {
                var data = result.data,
                    fileName = data[0],
                    url = data[1];
                if (fileName.indexOf('=') > -1)
                    fileName = fileName.split('=')[1];
                var host1 = location.hostname;
                var host ='http://192.168.4.77:8000';
                ajax({
                    url: 'http://' + host + '/webeditor.ashx?type=save',
                    type: 'post',
                    data: { 'filename': fileName, 'fileuri': url },
                    dataType: 'json',
                    async: false,
                    success: function (json) {
                        if (json.code == 200 || json.code == '200') {
                            alert('Successfully saved');
                        } else {
                            this.error(json, 'Failed to save');
                        }
                    },
                    error: function (json, msg) {
                        alert(+msg);
                    }
                });
            }
        };
        var connectEditor = function () {
            var type = 'desktop';
            if (type == "desktop") {
                var app = navigator.appVersion;
                if (app.toLowerCase().indexOf('window') != -1) {
                    type = "desktop";
                } else {
                    type = "mobile";
                }
            };
            var urlString ="https://cloud.e-iceblue.cn/demo/demo.docx";
            var arrfn = urlString.split(".");
            var strp= arrfn[arrfn.length - 1];
            var documentTypeValue=null;
             switch(strp){
             case "xls":
             case "xlsx":
             case "xlsm":
             case "xlt":
             case "xltx":
             case "xltm":
             case "ods":
             case "fods":
             case "ots":
             case "csv":
             documentTypeValue="spreadsheet";
             break;
             case "pps":
             case "ppsx":
             case "ppsm":
             case "ppt":
             case "pptx":
             case "pptm":
             case "pot":
             case "potx":
             case "potm":
             case "odp":
             case "fodp":
             case "otp":
             documentTypeValue="presentation";
             break;
             default:
             documentTypeValue="document";
             break;
             }

            docEditor = new SpireCloudEditor.OpenApi("iframeEditor",
                {
							fileAttrs: {
								fileInfo: {
									name: '',
									ext: '',
									primary: '',
									creator: '',
									createTime: new Date('20210505')
								},
								sourceUrl: urlString,
								createUrl: '',
								callbackUrl: 'http://192.168.4.77:3000/save?filename=demo.docx&useraddress=__ffff_192.168.3.121',////This item can be empty, but only if the 'onSave' callback function must be defined in events. If the callback function is undefined and this item is empty, Cloud Editor will not provide save function.
								verification: null,//If the user file system requires validation of token-like data when downloading files, it can be implemented here.
								canEdit: true,
								canDownload: false,
								canForcesave: false
							},
							user: {
								primary: '',
								name: '',
								canSave: true,
								customization: {
									public: {
										common: {
											whiteLabel: false,
											defaultZoom: 1,
											openReviewChanges: false,
											permGroups: ['everyone'],//Restrict Group Editing
											viewVersion: false,
											header: {
												hideTitle: false,
												defaultView: 'full'
											}
										},
										word: null,
										powerpoint: null,
										excel: null
									}
								}
							},
							editorAttrs: { // Editor configuration
								editorWidth: '100%',
								editorHeight: '100%',
								editorType: 'document', // Editor type (optional). The program will determine based on file type. Possible values: document, presentation, spreadsheet
								platform: 'desktop', // Editor platform type. Options: desktop, mobile, embedded
								viewLanguage: 'en', // UI display language. Options: en (English), zh (Chinese)
								canChat: true, // Whether chat feature is enabled
								canComment: true, // Whether commenting feature is enabled
								canReview: true, // Whether review feature is enabled
								embedded: {
									saveUrl: '', // URL for saving embedded content
									embedUrl: '', // URL for embedding content
									shareUrl: '' // URL for sharing content
								},
								events: {
								'onStart': onStart,
								'onDocumentStateChange': onDocumentStateChange,
								'onError': onError,
								'onSave': ''
								}
							}
                }
            );
        };
        if (window.addEventListener) {
            window.addEventListener("load", connectEditor);
        } else if (window.attachEvent) {
            window.attachEvent("load", connectEditor);
        }

    </script>
</head>
<body>
    <form name="form1" method="post" action="./docEditor.aspx?fileID=demo+(2).docx&lang=zh" id="form1">
<div>
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUKMTkyMjc5MTU4M2RkBQQQBsVcOHQbzTlwYapiES2Trc9Z/U4CC+r9rluZubc=" />
</div>
<div>
	<input type="hidden" name="__VIEWSTATEGENERATOR" id="__VIEWSTATEGENERATOR" value="C2EAC0DE" />
</div>
        <div id="iframeEditor">
        </div>
    </form>
</body>
</html>

Key Parameters

Configuration Parameters Example Value Explanation Set Value
fileAttrs File configuration object
fileInfo File information object
name File name Can be empty
ext Document name docx, xlsx, pptx
primary Document unique identifier Can be empty
creator Document creator Can be empty
createTime Document creation time Can be empty
sourceUrl Document URL Cannot be empty, must have access permissions
createUrl Template document URL when creating a new document Can be empty
callbackUrl Callback URL Can be empty. If online editing save functionality is required, either callback URL or callback event must be defined
verification Verification information Can be empty. When downloading files from user file system requires verification data like token, it can be written here
templates Document templates Can be empty
canEdit Whether the document can be edited Default is true. When set to false, saving is not allowed
canDownload Whether the document can be downloaded Default is true. When set to false, downloading is not allowed
user User configuration object
primary User ID Can be empty
name Username Can be empty
canSave Whether the user can save the document Default is true. When set to false, saving is not allowed
canSaveByShortcut Whether the user can save the document via shortcut Default is true. When set to false, saving via shortcut is not allowed
customization Custom parameters object
public Public parameters
common Common parameters object
whiteLabel White label Default is false. When set to true, the E-iceblue Logo icon will not be displayed
defaultZoom Zoom value Can be empty. Set range is 0.5-5
OpenReviewChagnes Whether to open revisions Default is false. When set to true, revisions are opened
openNavigation Open navigation bar Default is false. When set to true, the navigation bar is displayed
openAllComments Open comments list Default is false. When set to true, the comments list is displayed
CollaborationModeIsFast Set editing mode Whether collaborative editing mode is fast. When true, mode is fast; when false, mode is strict. When this parameter is not set, the last value from editor cache is used. If no cache, it's set to fast
CollaborationModeOnlyFast Disable strict mode Whether mode is fast only. Default is false. When true, sets to fast mode and disables strict mode
viewVersion View mode Default is false. When true, saving is not allowed
canDownloadInView Whether download is allowed in view mode Default is false. When true, download is allowed in view mode
canPrintInView Whether printing is allowed in view mode Default is false. When true, printing is allowed in view mode
openReviewPanel Open revisions list Default is false. When true, shows revisions list
hideRuler Hide ruler Default gets value from browser cache. When true, hides ruler; when false, shows ruler
hideStatusBar Hide status bar Default is false. When true, hides status bar
showBookmarks Show bookmarks indicator Default is true. When false, hides bookmarks indicator
keepTextOnly Paste text only by default Default is false. When true, only pastes text
permGroups Current user's group membership (this is an array) Default is all users, can input custom groups
socket_url Custom socket_url, mainly to solve port mismatch issues when using Nginx as reverse proxy after private deployment Can be empty
header
hideTitle Hide title Default is false. When true, hides title
defToolbar Toolbar view Default is "full", can be set to "full" or "short"
goback Back navigation object
url Back navigation URL Can be empty
btnPermissions Button permission control View button permission control table
previewShowCursor Show cursor in preview mode Default is true. When false, hides cursor
showCursor Show cursor Default is true. When false, hides cursor
cusWaterMarkJs Custom watermark JS Should be a URL address
canChangeProduct Whether product can be switched Default is false. When true, switching is allowed
showTableline Whether to show dotted lines for borderless tables Default is true. When false, hides dotted lines
document Word customization View corresponding customer's customization documentation
excel Excel customization View corresponding customer's customization documentation
powerpoint PPT customization View corresponding customer's customization documentation
aiCommon Public cloud id, key, and TokenUrl required for AI functionality View corresponding AI configuration documentation
aiAttars_WordAI Appkey and productType required for Word's AI functionality View corresponding AI configuration documentation
aiAttars_ExcelAI Appkey and productType required for Excel's AI functionality View corresponding AI configuration documentation
aiAttars_PowerPointAI Appkey and productType required for PPT's AI functionality View corresponding AI configuration documentation
editorAttrs Editor configuration object
editorMode Edit mode
Can be 'edit' (edit) or 'view' (view)
Can be empty, defaults to 'edit'
editorWidth Width Can be empty, default value 100%
editorHeight Height Can be empty, default value 100%
editorType File editor type Can be unconfigured, program gets from file type. Must be set to document or spreadsheet or presentation
platform Editor platform type
'desktop' (desktop display), 'mobile' (mobile display), 'embedded' (embedded display)
Cannot be empty, must be set to one of desktop, mobile or embedded
viewLanguage Platform interface display language Can be empty, "en" or "zh". If empty, matches browser default language
canChat Whether chat is enabled Default is true. When false, chat is disabled
canComment Whether comments are enabled Default is true. When false, comments are disabled
canReview Whether revisions are enabled Default is true. When false, revisions are disabled
canForcesave Whether document can be force-saved Default is true. When false, force-saving is not allowed
unMarked Enable unmarked mode (accept revisions) Can be empty, default is false. When true, enables unmarked mode (accepts revisions)
canSignature Whether to enable signature/seal functionality Can be empty, default is false. When true, enables signature/seal functionality
canWordAI Whether to enable Word's AI functionality Can be empty, default is false. When true, enables Word's AI functionality
canExcelAI Whether to enable Excel's AI functionality Can be empty, default is false. When true, enables Excel's AI functionality
canPowerPointAI Whether to enable PPT's AI functionality Can be empty, default is false. When true, enables PPT's AI functionality
events Events
onStart Triggered when editor initialization completes and starts loading/parsing document
onDocumentContentReady Triggered when document loading completes
onSave Triggered when saving
onDocumentStateChange Triggered when document state changes (document has saved and unsaved states)
onError Triggered when error occurs
onErrorCallback Callback when clicking error popup Normally, clicking error popup navigates to page specified by fileAttrs.customization.public.common.goback.url. If user customizes this function, calls the function instead and URL becomes invalid
Published in Getting Started

Spire.Cloud.Office is a HTML5-based document editor that allows users to view and edit Word and Excel documents in a web browser. After installing it on your server, you'll be able to run the editor in your own web application. This article will show you how to install Spire.Cloud.Office for Linux on Ubuntu.

Step 1. Configure the Environment

1) Turn off the firewall

Run the script ufw status verbose with root permissions (all scripts in this tutorial are recommended to run as root) to view the firewall status. If the status is inactive, no other settings are required; If the status is active, use the script ufw disable to turn off the firewall.

Install Spire.Cloud.Office for Linux on Ubuntu

2) Configure a static IP address

Use the script vim /etc/netplan/*.yaml to open the network configuration file to configure a static IP address.

Install Spire.Cloud.Office for Linux on Ubuntu

Use the script netplan apply to apply the network settings, and use the script ifconfig -a to check if the IP address is successfully applied.

Install Spire.Cloud.Office for Linux on Ubuntu

Step 2. Copy Spire.Cloud.Office to Ubuntu

Download Spire.Cloud.Office for Linux package, and unzip it somewhere on your disk. We'll use WinSCP to copy files from Windows system to the root of Ubuntu system.

1) Log in to WinSCP

Install Spire.Cloud.Office for Linux on Ubuntu

If the connection fails and an error appears as shown in the figure below, please check whether sshd is installed on the server.

Install Spire.Cloud.Office for Linux on Ubuntu

If not installed, refer to the following solution:

First, run the script apt-get install yum, and then enter Y to continue.

Install Spire.Cloud.Office for Linux on Ubuntu

Secondly, run the script apt-get install openssh-server, and enter Y to continue.

Install Spire.Cloud.Office for Linux on Ubuntu

Finally, run the script ps -e|grep ssh, and you'll see sshd has been successfully installed.

Install Spire.Cloud.Office for Linux on Ubuntu

By default, the root user is not allowed to perform SSH remote login. You can enter the configuration file using vim /etc/ssh/sshd_config, change PermitRootLogin to yes, and then run service sshd restart to activate the setting.

Install Spire.Cloud.Office for Linux on Ubuntu

2) Copy files

After the connection is successful, copy the files contained in Spire.Cloud.Office for Linux package to the /root/cloud/ directory of the Ubuntu system. The "cloud" folder here is a newly created folder and can be named arbitrarily.

Install Spire.Cloud.Office for Linux on Ubuntu

Step 3. Install Spire.Cloud.Office for Linux

Enter the folder where the file "install_ubuntu18.04.sh" is located, then run the script bash install_ubuntu18.04.sh to install Spire.Cloud.Office on Ubuntu.

Install Spire.Cloud.Office for Linux on Ubuntu

After the installation is completed, you'll get the following output.

Install Spire.Cloud.Office for Linux on Ubuntu

Step 4. Bind License

Copy your license file to the /root/cloud/spire.cloud/service/ConverterService/bin/license/ directory through WinSCP. If you need a temporary license to evaluate our product, please contact sales.

Install Spire.Cloud.Office for Linux on Ubuntu

Enter the folder that contains the file "binding_license.sh", then run the script bash binding_license.sh to bind the license.

Install Spire.Cloud.Office for Linux on Ubuntu

After the license is successfully bound, you'll get the following output.

Install Spire.Cloud.Office for Linux on Ubuntu

Now that you've successfully installed Spire.Cloud.Office for Linux on Ubuntu, you can visit our example on port 3000, or you can embed the document editor in your HTML page using JavaScript.

Install Spire.Cloud.Office for Linux on Ubuntu

Published in Getting Started
Thursday, 21 April 2022 03:13

Install Spire.Cloud.Office on Windows

Spire.Cloud.Office is an Office suite that contains online editors for Word and Excel documents. It can be installed on your local server and integrated into your own web application to view, create & edit Word and Excel documents. This guide will teach you how to install Spire.Cloud.Office on Windows system.

Step 1. Install Spire.Cloud.Office

1) Download the installer of Spire.Could.Office for Windows.

2) Turn off the antivirus program if you have any.

3) Run the installer and follow the wizard steps.

Choose "I accept the agreement" and press "Next".

Install Spire.Cloud.Office for .NET on Windows

Set install location and go to the next step. Please make sure that your user account has appropriate permissions to access the specified installation directory, otherwise you may fail to bind the license later.

Install Spire.Cloud.Office for .NET on Windows

Press "Install" to install Spire.Cloud.Office for .NET to the specified location.

Install Spire.Cloud.Office for .NET on Windows

Press "Next" to accomplish system checking and fonts’ installation.

Install Spire.Cloud.Office for .NET on Windows

Install Spire.Cloud.Office for .NET on Windows

Install Spire.Cloud.Office for .NET on Windows

Install Spire.Cloud.Office for .NET on Windows

Press "Start service" to start the service and then click "Finish" to finish the installation.

Install Spire.Cloud.Office for .NET on Windows

Install Spire.Cloud.Office for .NET on Windows

Install Spire.Cloud.Office for .NET on Windows

Step 2. Bind License

A license is required to run Spire.Cloud.Office for .NET editor, please contact our sales department (sales@e-iceblue.com) to request one. Then follow the steps below to bind the license.

Drag the license (license.elic.xml) to the wizard or press "Choose" to choose the license from your system.

Install Spire.Cloud.Office for .NET on Windows

Press "Bind" to bind the license.

Install Spire.Cloud.Office for .NET on Windows

After the license binding has completed, press "Exit" to quit the wizard.

Install Spire.Cloud.Office for .NET on Windows

Now, Spire.Cloud.Office for .NET is ready for use. If you type "[your server ip]:3000" (in this article, we use 192.168.0.121:3000) in your browser's address bar and press enter, the following page will appear:

Install Spire.Cloud.Office for .NET on Windows

You can upload an existing Word/Excel file or create a new one from scratch by selecting the "Upload File" or "Create Document/Spreadsheet" option. Here we upload an existing Word file:

Install Spire.Cloud.Office for .NET on Windows

Published in Getting Started