Search code examples
angularsyncfusion

extract the edited text and hide the right side toolbar by default in syncfusion document editor component


I am using ej2 sync fusion in my angular 7 application. How to extract the edited text in document editor component. and how to hide the right side toolbar on creation of the document editor component.


Solution

  • Reg. how to extract the edited text.

    To extract the whole document text in editor, you can either select the whole document by selectAll API from selection module and with text property from selection, you can get the selected text.

    Please refer the below sample code snippets

    //Selects the whole document.

    containerInstance.documentEditor.selection.selectAll()

    //To retrieve selected text

    containerInstance.documentEditor.selection.text

    You can also save the document as txt file in server-side and read the text file content to get the document text.

    Please refer the below documentation for saving the document content in server side

    https://ej2.syncfusion.com/angular/documentation/document-editor/export/#export-as-blob

    In the above documentation example, sample will be saved as RTF document. You can change the format to TXT and read the text content from text file.

    Reg. “how to hide the right-side toolbar on creation of the document editor component.”

    Yes, document editor provides option to hide the properties pane. Please set showPropertiesPane property to false in component wrapper

    Sample code snippet

    <ejs-documenteditorcontainer #documenteditor_default [enableToolbar]=true [showPropertiesPane]=false height="600px" style="display:block;">