Edit DOC in C# .NET

Effective and robust DOC editing using server side GroupDocs.Editor for C# .NET APIs, without the use of any software like Microsoft or Open Office.


Download Free Trial

About GroupDocs.Editor for .NET API

GroupDocs.Editor for .NET API is a right choice to edit Microsoft Word, Excel, PowerPoint, Open Office documents and presentations. GroupDocs.Editor is a standalone API that is suitable for server side and back-end systems where high performance is required. It does not depend on any software like Microsoft or Open Office.

Steps to Edit DOC in C#

GroupDocs.Editor for .NET provides an easy and straightforward way for developers to edit the DOC files using a few lines of code.

  • Create an instance of Editor class with mandatory file path or stream and optional WordProcessingLoadOptions class and load the DOC file
  • Create & set the WordProcessingEditOptions class instance for the DOC file format
  • Call Editor.Edit() method and obtain DOC document in HTML format that is easily editable with any WYSIWYG-editor.
  • Call Editor.Save() method and save edited DOC file using WordProcessingSaveOptions class

System Requirements

A basic document editing with GroupDocs.Editor for .NET APIs can be done by implementing a few easy steps. Our APIs are supported on all major platforms and operating systems. Before executing the code below, please make sure that you have the following prerequisites installed on your system.

  • Operating Systems: Microsoft Windows, Linux, MacOS
  • Development Environments: Microsoft Visual Studio, Xamarin, MonoDevelop
  • Frameworks: .NET Framework, .NET Standard, .NET Core, Mono
  • Get the latest version of GroupDocs.Editor for .NET downloaded from NuGet

// Load the DOC file into Editor with the optional WordProcessingLoadOptions
Editor editor = new Editor("source.doc", delegate { return new WordProcessingLoadOptions(); });

// Create and adjust the edit options
WordProcessingEditOptions editOptions = new WordProcessingEditOptions();

// Open input DOC document for edit — obtain an intermediate document, that can be edited
EditableDocument beforeEdit = editor.Edit(editOptions);

// Grab DOC document content and associated resources from editable document
string content = beforeEdit.GetContent();

// Send the content to WYSIWYG-editor, edit it there, and send edited content back to the server-side
// This step simulates a such operation
string updatedContent = content.Replace("Subtitle", "Edited subtitle");

// Grab edited content and resources from WYSIWYG-editor and create a new EditableDocument instance from it
EditableDocument afterEdit = EditableDocument.FromMarkup(updatedContent, null);

// Create a save options and select a desired output format
WordProcessingSaveOptions saveOptions = new WordProcessingSaveOptions(Formats.WordProcessingFormats.Doc);

// Save edited DOC document to the file
editor.Save(afterEdit, "edited.doc", saveOptions);

DOC Editor Live Demos

Edit DOC right now by visiting GroupDocs.Editor Live Demos website.
The live demo has the following benefits

No need to download API

No need to write any code

Just upload the source file

Get download link to save the file

Other Supported Editors

You can also edit other file formats. Please see the complete list below.

DOCX

(Office 2007+ Word Document)

DOCM

(Microsoft Word 2007 Marco File)

DOTX

(Microsoft Word Template File )

ODT

(OpenDocument Text File Format)

XLS

(Microsoft Excel Spreadsheet (Legacy))

XLSX

(Open XML Workbook)

XLSM

(Macro-enabled Spreadsheet)

PPT

(Microsoft PowerPoint 97-2003)

PPTX

(Open XML presentation Format)

PPTM

(Macro-enabled Presentation File)

MOBI

(Open Ebook Format)

EPUB

(Open eBook File)

HTML

(Hyper Text Markup Language)

MHTML

(Web Page Archive Format)

TXT

(Text Document)

XML

(XML File)

CSV

(Comma Seperated Values)

PDF

(Portable Document Format)

XPS

(XML Paper Specifications)

MSG

(Outlook Message Item File)

Back to top
 English