GroupDocs.Editor
Load, edit, and save documents through an HTML round-trip — with a single, consistent API across .NET, Java, Node.js, and Python.
Choose your platform selecting one updates the snippets below
Node.js
v26.1.0
Getting started with .NET
using System;
using GroupDocs.Editor;
using GroupDocs.Editor.Options;
// Pass source document to initialize the Editor
var editor = new Editor("input.docx");
// Open document for edit
var originalDoc = editor.Edit();
// Get document as HTML
var srcHtml = originalDoc.GetEmbeddedHtml();
// Edit document contents
var editedHtml = srcHtml.Replace("Old text", "New text");
// Load edited document from HTML
var editedDoc = EditableDocument.FromMarkup(editedHtml, null);
// Save edited document to file with desired format
var saveOptions = new WordProcessingSaveOptions();
editor.Save(editedDoc, "output.docx", saveOptions);
import com.groupdocs.editor.*;
import com.groupdocs.editor.options.*;
// Pass source document to initialize the Editor
Editor editor = new Editor("input.docx");
// Open document for edit
EditableDocument originalDoc = editor.edit();
// Get document as HTML
String srcHtml = originalDoc.getEmbeddedHtml();
// Edit document contents
String editedHtml = srcHtml.replace("Old text", "New text");
// Load edited document from HTML
EditableDocument editedDoc = EditableDocument.fromMarkup(editedHtml, null);
// Save edited document to file with desired format
WordProcessingSaveOptions saveOptions = new WordProcessingSaveOptions();
editor.save(editedDoc, "output.docx", saveOptions);
const groupdocs = require('@groupdocs/groupdocs.editor');
// Pass the source document to initialize the Editor
const editor = new groupdocs.Editor("input.docx");
// Open the document for editing
const originalDoc = editor.edit();
// Get the document as HTML, then edit its contents
const editedHtml = originalDoc.getEmbeddedHtml().replace("Old text", "New text");
// Load the edited document back from HTML
const editedDoc = groupdocs.EditableDocument.fromMarkup(editedHtml, null);
// Save the edited document to the desired format
editor.save(editedDoc, "output.docx", new groupdocs.WordProcessingSaveOptions());
from groupdocs.editor import Editor, EditableDocument
from groupdocs.editor.formats import WordProcessingFormats
from groupdocs.editor.options import WordProcessingSaveOptions
# Pass source document to initialize the Editor
with Editor("input.docx") as editor:
# Open document for edit
original = editor.edit()
# Get document as HTML
html = original.get_embedded_html()
# Edit document contents
edited_html = html.replace("Old text", "New text")
# Load edited document from HTML
edited = EditableDocument.from_markup(edited_html)
# Save edited document to file with desired format
editor.save(edited, "output.docx", WordProcessingSaveOptions(WordProcessingFormats.DOCX))
Popular classes & namespaces
Class
Editor
GroupDocs.Editor
Method
Editor.Edit
GroupDocs.Editor
Class
EditableDocument
GroupDocs.Editor
Class
WordProcessingEditOptions
Editor.Options
Class
WordProcessingSaveOptions
Editor.Options
Class
HtmlSaveOptions
Editor.Options
Interface
ISaveOptions
Editor.Options
Class
WordProcessingFormats
Editor.Formats
Key capabilities
- Edit via HTML round-trip
- Load, edit & save documents
- Format-specific options
- Protect documents
- Extract content
- Word, Excel, PowerPoint & more
Supported formats
WordExcelPowerPointTextHTMLEmail
…and 50+ more word-processing, spreadsheet, and web formats.
Resources
Was this page helpful?
Any additional feedback you'd like to share with us?
Please tell us how we can improve this page.
Thank you for your feedback!
We value your opinion. Your feedback will help us improve our documentation.