# Edit documents with GroupDocs.Editor Round-trip a document through HTML so a web editor can change it, then save it back with GroupDocs.Total for Node.js via Java — runnable JavaScript examples with downloadable files. GroupDocs.Editor has no user interface of its own, and that is the thing to understand before reading the code. It converts a document **to HTML** so that a third-party WYSIWYG editor — TinyMCE, CKEditor, anything that edits HTML — can display and change it, then converts the edited HTML **back** into the original format. So the shape is a three-stage round trip rather than a single call: ```text editor.edit() your web editor editor.save() document ──────────► EditableDocument ──► HTML ──► edited HTML ──────────► document ``` The examples below follow those three stages in order. ## Stage 1 and 2: open a document and get its HTML `edit` returns an `EditableDocument`. `getBodyContent` gives you the markup to hand to the browser; `getEmbeddedHtml` gives a self-contained page with images and styles inlined. {{< tabs "editor-document-to-html" >}} {{< tab "JavaScript" >}} ```js import { Editor } from '@groupdocs/groupdocs.total'; import java from 'java'; import { writeFileSync } from 'fs'; const WordProcessingEditOptions = java.import( 'com.groupdocs.editor.options.WordProcessingEditOptions' ); const editor = new Editor('contract.docx'); // Stage 1: parse the document into an editable form const document = editor.edit(new WordProcessingEditOptions()); // Stage 2: the HTML your web editor would load const bodyHtml = document.getBodyContent(); // getEmbeddedHtml() is a self-contained page with images and styles inlined writeFileSync('editor-document-to-html.html', document.getEmbeddedHtml()); console.log('Body HTML length: ' + bodyHtml.length + ' characters'); editor.dispose(); ``` {{< /tab >}} {{< tab "contract.docx" >}} {{< tab-text >}} `contract.docx` is the sample file used in this example. Click [here](https://docs.groupdocs.com/total/nodejs-java/_sample_files/contract.docx) to download it. {{< /tab-text >}} {{< /tab >}} {{< tab "editor-document-to-html.html" >}} ```text