Articles in this section
Category / Section

How to get started with Angular 7 WordProcessor component?

3 mins read

The Essential JS 2 Angular Word Processor is a component that have editing capabilities like Microsoft Word. It is also known as document editor, and it is used to create, edit, view, and print the Word documents. It provides all the common Word processing features including editing text, formatting contents, resizing image and tables, finding and replacing text, bookmarks, tables of contents, printing, and importing and exporting Word documents. This article explains how to easily integrate Syncfusion Angular Word Processor in Angular 7 application and how to enable its commonly used features using services.

Prerequisites

Before start, the following items are required to create Angular Word Processor in Angular 7 application:

Installation and application creation

  1. Install Angular cli 7 using the following command.
    npm install -g @angular/cli@7.0.5
    

 

Angular package installation log

Note:

To follow and run the application in Angular 6, Angular 5, or Angular 4, you should replace the CLI command version number with corresponding Angular version number.

 

npm install -g @angular/cli@<CLI VERSION>

  1. Create an Angular 7 application using Angular cli.
          ng new angular7-app
          cd angular7-app
    
  1. Serve the Angular 7 application using the following command.
           ng serve
    

 

Listen the application in localhost:4200. Your application will serve in the browser as follows.

 

Angular app running.

 

Integration of Angular Word Processor a.k.a Document Editor

  1. After running the Angular 7 application successfully, configure the Angular Document Editor in this application. Install Angular Document Editor and EJ2 package using the following command. The —save command will instruct the NPM to include a document editor package inside the dependencies section of the package.json.
               npm install @syncfusion/ej2-angular-documenteditor --save 
               npm install @syncfusion/ej2 --save 
    

          

 

  1. Import DocumentEditorContainerAllModule from installed package in app/app.module.ts.
    import { BrowserModule } from '@angular/platform-browser';
    import { NgModule } from '@angular/core';
    import { DocumentEditorContainerAllModule } from '@syncfusion/ej2-angular-documenteditor';
    import { AppComponent } from './app.component';
     
    @NgModule({
      declarations: [
        AppComponent
      ],
      imports: [
        BrowserModule, DocumentEditorContainerAllModule
      ],
      providers: [],
      bootstrap: [AppComponent]
    })
    export class AppModule { }
    

 

  1. You should refer to the CSS file for Angular Document Editor in style.css     
    @import "../node_modules/@syncfusion/ej2/material.css";
    
  1. Add the Angular Document Editor component in app.component.html.
               <ejs-documenteditorcontainer></ejs-documenteditorcontainer>
    
  1. Now, define the service URL for this Document Editor in app.component.ts. Service URL is required for opening a Word document (Refer to https://ej2.syncfusion.com/angular/documentation/document-editor/import/?no-cache=1#convert-word-documents-into-sfdt )
    import { Component, ViewChild } from '@angular/core';
    import { ToolbarService } from '@syncfusion/ej2-angular-documenteditor';
     
    @Component({
      selector: 'app-root',
      templateUrl: './app.component.html',
      styleUrls: ['./app.component.css'],
      providers: [ToolbarService]
    })
    export class AppComponent {
      title = 'angular7-app';
      public serviceLink: string;
      ngOnInit() {
        //Service URL is required for opening word documents in DocumentEditor
        //Documentation link: https://ej2.syncfusion.com/angular/documentation/document-editor/import/?no-cache=1#convert-word-documents-into-sfdt
        this.serviceLink = 'https://ej2services.syncfusion.com/production/web-services/api/documenteditor/';
      }
    } 
    
  1. After defining service link, define Document Editor’s serviceUrl in app.component.html.
    <ejs-documenteditorcontainer #documenteditor_default [serviceUrl]='serviceLink' style="display:block;height:600px"></ejs-documenteditorcontainer>
    
  1. Now, serve the application using following command.
     ng serve --open
    

After all the files are compiled successfully, it will serve the site at localhost:4200

The following screenshot explains this.

Angular DocumentEditor

Summary

In this GitHub repository, the application prepared from the previous steps has been committed, and it is readily runnable. Also, you can check Syncfusion Angular WordProcessor a.k.a DocumentEditor features from this page.

If you have any queries or require clarifications, please let us know in comments below. You can also contact us through Syncfusion Support forum or Direct-Trac. We are happy to assist you!

 

Conclusion
I hope you enjoyed learning about h
ow to get started with Angular 7 WordProcessor component.

You can refer to our Angular editors feature tour page to know about its other groundbreaking feature representations and documentation, and how to quickly get started for configuration specifications. You can also explore our Angular editors example to understand how to create and manipulate data.

For current customers, you can check out our Document Processing Libraries from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our controls.

If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forumsDirect-trac, or feedback portal. We are always happy to assist you!

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied