Spire.OfficeJS: Product Overview and Key Features
Spire.OfficeJS is an online Office document editing suite that supports private deployment. It is also an embeddable online Office editor for developers and enterprises that need to integrate document editing into their own web applications. Users can open, view, edit, and save Word, Excel, and PowerPoint documents directly in the browser, and preview PDFs in read-only mode. No Microsoft Office, WPS, or browser plug-in is required on the client.
Rather than fragmented, low-level APIs, Spire.OfficeJS provides a JavaScript Office editor that can be embedded directly into business pages. The page loads SpireCloudEditor.js, prepares a container element, and passes in the configuration; the editor then loads the corresponding interface as an iframe. Document parsing, layout, rendering, and editing are handled by default by the in-browser WebAssembly document engine. This does not mean there is nothing to deploy, however: SpireCloudEditor.js, the editor UI, the WebAssembly engine, and resources such as fonts must still be hosted on a resource service that the browser can reach. For the full product composition and runtime architecture, see Product Composition and Runtime Architecture.
Key Features
- Online editing: Online editing for Word, Excel, and PowerPoint documents; open, view, edit, and save documents in the browser, with "Download as" export.
- PDF preview: Read-only PDF preview within the same interface.
- Collaboration and review: Supports collaborative editing, comments, revisions, and document history.
- UI customization: Supports appearance options such as the menu bar, toolbar, interface language, and multiple layouts, for flexible control over the interface.
Product Composition
Spire.OfficeJS ships three editor modules plus PDF preview, all sharing a single editor entry point and runtime:
| Document Type | Editor Module | Document Engine | Key Capabilities |
|---|---|---|---|
| Word documents | web/editors/spiredocument |
Spire.Doc WebAssembly |
Open, view, edit, save, and "Download as" |
| Excel workbooks | web/editors/spirespreadsheet |
Spire.Xls WebAssembly |
Open, view, edit, save, and "Download as" |
| PowerPoint presentations | web/editors/spirepresentation |
Spire.Presentation WebAssembly |
Open, view, edit, save, and "Download as" |
| PDF documents | — (provided by spiredocument) |
Spire.Pdf WebAssembly |
Read-only preview |
Each editor module offers three interface layouts: desktop, mobile, and embed. For the complete list of supported formats, see Supported File Formats.
Typical Use Cases
| Scenario | Typical Requirement | Role of Spire.OfficeJS |
|---|---|---|
| Document management systems | Online preview, editing, and saving of Office files | Open the editor directly beside the file list, cutting out uploads and downloads |
| OA, approval, and contract systems | Annotations, revisions, permission control, and audit trails | Control edit, comment, and download permissions by role; support review and history |
| Enterprise cloud storage and SaaS platforms | Embed document capabilities into your own product | Fit into existing branding and workflows through configuration and UI customization |
| Online education and training | Assignment grading, courseware preview, and group discussion | Online editing and comments, with read-only mode for presenting materials |
| Archives and knowledge bases | Unified preview across multiple formats | Open Word, Excel, PowerPoint, and PDF documents in a single interface |
How It Differs from Self-Built and Public Cloud Solutions
Integrating document capabilities into a business system involves trade-offs whichever approach you take. First, the download–edit–re-upload workflow is fragmented. Second, building browser-side rendering and editing in-house is costly. Third, relying on server-side conversion adds load. And fourth, public cloud office suites make it difficult to fully align the interface, permissions, and data storage with your business system. Spire.OfficeJS handles document processing inside the browser, covers Word, Excel, PowerPoint, and PDF through a single entry point, and keeps both deployment resources and document data on your side through private deployment—making it well suited to scenarios with requirements around data location, UI branding, and deployment method.
Licensing
Spire.OfficeJS is a commercial component. The license file path is specified through a configuration file in the product package. For details on placing and activating the license, see Spire.OfficeJS License Configuration.
File Formats Supported by Spire.OfficeJS
Spire.OfficeJS supports four document types—Word, Excel, PowerPoint, and PDF. The first three can be opened and edited, while PDF is preview-only. For new documents and long-term storage, use DOCX, XLSX, and PPTX, for interoperability with WPS Office, use WPS, ET, and DPS, for external distribution and archiving, use PDF.
Supported Formats
| Document Type | Editor Module | Supported Operations | Formats |
|---|---|---|---|
| Word documents | spiredocument |
Open and edit | DOCX, DOCM, DOC, DOTX, DOTM, DOT, ODT, FODT, OTT, TXT, WPS, WPT |
| Excel spreadsheets | spirespreadsheet |
Open and edit | XLSX, XLSM, XLS, XLTX, XLTM, XLT, CSV, ET, ETT |
| PowerPoint presentations | spirepresentation |
Open and edit | PPTX, PPTM, PPT, PPSX, PPSM, PPS, POTX, POTM, POT, DPS, DPT |
| PDF documents | spiredocument |
Preview only | PDF, XPS |
- Legacy formats (DOC, XLS, PPT) can be opened and edited, saving them as DOCX, XLSX, and PPTX is recommended.
- RTF, HTML, HTM, and MHT are not in the Word open list and must be converted to DOCX first.
- Missing fonts used by a document cause changes in line breaks and pagination. See Font Management for configuration.
- PDF is preview-only, no editing entry is provided.
Saving and Exporting
Saving usually keeps the original format. File data can be passed to your business system through fileAttrs.callbackUrl or editorAttrs.events.onSave. Downloads are available from “File → Download as…”. The table below lists the formats available in that menu; actual options may vary by version or runtime mode:
| Document Type | Download Formats |
|---|---|
| Word | DOCX, DOC, DOCM, DOTX, DOTM, DOT, PDF, RTF, TXT, HTML, XPS, EPUB, WordXML (Word 2003 XML) |
| Excel | XLSX, XLS, XLSM, XLSB, XLTX, XLTM, XLT, CSV, ODS, ET, ETT, PDF, XPS |
| PowerPoint | PPTX, PPT, PPTM, PPSX, PPS, POTX, POTM, DPS, DPT, PDF, XPS, PS (PostScript) |
| Downloads the original file as-is, format conversion is not available |
When called through downloadAs, the supported range is narrower than the table above. See Conversion and Download for accepted values and examples.
In WebAssembly (serverless) mode, downloads are processed by the engine in the browser, so no separate conversion service is required. Cross-format exports reflow the document, so special fonts and complex layouts may render differently, check each page after exporting.
Spire.OfficeJS: Product Components and Runtime Architecture
Spire.OfficeJS consists of a set of browser-side editor resources (web) plus optional server-side components. The example service (the demo service, default port 3000) and service/OfficeServer (the editor service, default port 8000) in the product package are not mandatory: the web resources can be served by the editor service, or copied into your own front-end project and published with it.
Product Components
| Component | Location | Responsibility | When needed |
|---|---|---|---|
| Front-end resources | web |
Editor UI, WebAssembly engine, fonts, third-party dependencies | Required |
| Editor service | service/OfficeServer |
Resource delivery, runtime APIs, collaborative editing, cache, license configuration | Required for out-of-the-box use; optional for self-hosted front-end integration |
| Example service | example |
Demo document management system and sample documents | Trial and demos only |
| Font generation tool | generateWebFonts |
Provides the font install and generation component used to build web/fontsweb |
Before first deployment or copying resources |
The product package also includes two deployment scripts, run_servers_* and run_genallfonts_*. The first starts the example service (3000) and the editor service (8000) in one step; the second generates the web/fontsweb web font resources. Both are wrappers around the product components.
Runtime Architecture
Whichever deployment mode you use, the editor in the browser works the same way:

The three flows cover the key steps of an editing session:
- Load resources: The business page loads
SpireCloudEditor.js. The editor iframe infers thewebresource root from the entry script URL, then loads the editor UI, the WebAssembly engine, and fonts. - Read documents: The browser reads files from business storage through
fileAttrs.sourceUrl. In serverless mode, document content is passed in througheditorAttrs.serverless.fileData. - Save documents: Results go back to the business system through
fileAttrs.callbackUrloreditorAttrs.events.onSave. For collaboration, edits are also synchronized throughcoAuthorUrl.
The business system handles the file list, permissions, and file storage. The editor parses, renders, and edits. Resources are hosted by the editor service or a static site, and collaborative editing is provided by the editor service that coAuthorUrl points to.
Deployment Modes
The same web resources can be hosted in two common ways. They are not two product versions, but two placements of the same editor resources:
| Out of the box | Embedded in your own front end | |
|---|---|---|
| Startup | Run run_servers_* |
Run or publish your own front-end project |
| Example service 3000 | Used; provides the demo document system | Not used |
| Editor service 8000 | Used; provides resources and APIs | Usually not used; deploy only when server-side features such as collaboration are needed |
web resources |
Served by the editor service | Copied into the front-end static directory and published with the project |
| Document source | Demo documents, or sourceUrl |
serverless.fileData, or sourceUrl |
| Save method | Demo system save, callbackUrl |
events.onSave, or callbackUrl |
| Use case | Trial, validation, demos | Production integration into your own product |
Out of the Box
Running the startup scripts included in the product package starts both the example service on 3000 and the editor service on 8000. Open http://localhost:3000 to enter the demo document system. See Run the demo.
Embedded in Your Own Front End
In this mode, the front-end project hosts the web resources. For the directory layout, initial configuration, and how documents are passed in and saved, see Integration example. File storage, permissions, and the file list remain the business system's responsibility.
Common Misconceptions
- "Ports 3000 and 8000 must both run": No. They belong to the out-of-the-box deployment mode only. When embedding into your own front end, you can put the
webresources in the project's static directory and publish them directly with the front-end project. - "A pure front end means no service deployment at all": No. Document processing runs in the browser, but the
webresources still need to be hosted by a static server, Nginx, or a CDN. - "The example service must ship to production too": It doesn't. The example service is for trial and demos only; you can stop it in production.