# 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 Java — runnable Java 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 "Java" >}} ```java import com.groupdocs.editor.EditableDocument; import com.groupdocs.editor.Editor; import com.groupdocs.editor.options.WordProcessingEditOptions; import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Paths; Editor editor = new Editor("contract.docx"); // Stage 1: parse the document into an editable form EditableDocument document = editor.edit(new WordProcessingEditOptions()); // Stage 2: the HTML your web editor would load String bodyHtml = document.getBodyContent(); // getEmbeddedHtml() is a self-contained page with images and styles inlined Files.write(Paths.get("editor-document-to-html.html"), document.getEmbeddedHtml().getBytes(StandardCharsets.UTF_8)); System.out.println("Body HTML length: " + bodyHtml.length() + " characters"); ``` {{< /tab >}} {{< tab "contract.docx" >}} {{< tab-text >}} `contract.docx` is the sample file used in this example. Click [here](https://docs.groupdocs.com/total/java/_sample_files/contract.docx) to download it. {{< /tab-text >}} {{< /tab >}} {{< tab "editor-document-to-html.html" >}} ```text