Table of Contents

Method Save

Namespace
DocWright
Assembly
DocWright.dll

Save(WordDocument, Stream, string, SaveOptions?)

Saves a document back to a word-processing format, chosen by file extension.

Routed through FormatRegistry so a host-registered writer is reachable exactly the way a host-registered reader is. Saving is distinct from Convert(WordDocument, Stream, ConvertOptions?): converting renders the document to PDF, while saving round-trips it in an editable format, preserving everything the source carried.

public void Save(WordDocument document, Stream output, string extension = ".docx", SaveOptions? options = null)

Parameters

document WordDocument

The document to save.

output Stream

The writable stream that receives the package bytes.

extension string

The target extension, for example ".docx".

options SaveOptions

The save options, or null for defaults.

Exceptions

ArgumentNullException

document or output is null.

ArgumentException

output is not writable, or the extension is empty.

UnsupportedFeatureException

No writer is registered for the extension.