WordprocessingDocument.Open method (Stream, Boolean, OpenSettings)

Office 2013 and later

Creates a new instance of the WordprocessingDocument class from the IO stream.

Namespace:  DocumentFormat.OpenXml.Packaging
Assembly:  DocumentFormat.OpenXml (in DocumentFormat.OpenXml.dll)

public static WordprocessingDocument Open(
	Stream stream,
	bool isEditable,
	OpenSettings openSettings
)

Parameters

stream
Type: System.IO.Stream

The IO stream on which to open the WordprocessingDocument.

isEditable
Type: System.Boolean

In ReadWrite mode. False for Read only mode.

openSettings
Type: DocumentFormat.OpenXml.Packaging.OpenSettings

The advanced settings for opening a document.

Return value

Type: DocumentFormat.OpenXml.Packaging.WordprocessingDocument
A new instance of WordprocessingDocument.

ExceptionCondition
ArgumentNullException

Thrown when "stream" is null reference.

IOException

Thrown when "stream" is not opened with Read (ReadWrite) access.

OpenXmlPackageException

Thrown when the package is not valid Open XML WordprocessingDocument.

ArgumentException

Thrown when specified to process the markup compatibility but the given target FileFormatVersion is incorrect.

Show: