共用方式為


WordprocessingDocument.Create Method

Definition

Overloads

Create(Package, WordprocessingDocumentType)

Creates a new instance of the WordprocessingDocument class from the specified package.

Create(Stream, WordprocessingDocumentType)

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

Create(String, WordprocessingDocumentType)

Creates a new instance of the WordprocessingDocument class from the specified file.

Create(Package, WordprocessingDocumentType, Boolean)

Creates a new instance of the WordprocessingDocument class from the specified package.

Create(Stream, WordprocessingDocumentType, Boolean)

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

Create(String, WordprocessingDocumentType, Boolean)

Creates a new instance of the WordprocessingDocument class from the specified file.

Create(Package, WordprocessingDocumentType)

Creates a new instance of the WordprocessingDocument class from the specified package.

public static DocumentFormat.OpenXml.Packaging.WordprocessingDocument Create (System.IO.Packaging.Package package, DocumentFormat.OpenXml.WordprocessingDocumentType type);
static member Create : System.IO.Packaging.Package * DocumentFormat.OpenXml.WordprocessingDocumentType -> DocumentFormat.OpenXml.Packaging.WordprocessingDocument
Public Shared Function Create (package As Package, type As WordprocessingDocumentType) As WordprocessingDocument

Parameters

package
Package

The specified OpenXml package.

type
WordprocessingDocumentType

The type of the WordprocessingDocument.

Returns

A new instance of WordprocessingDocument.

Exceptions

Thrown when "package" is null reference.

Thrown when "package" is not opened with Write access.

Applies to

Create(Stream, WordprocessingDocumentType)

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

public static DocumentFormat.OpenXml.Packaging.WordprocessingDocument Create (System.IO.Stream stream, DocumentFormat.OpenXml.WordprocessingDocumentType type);
static member Create : System.IO.Stream * DocumentFormat.OpenXml.WordprocessingDocumentType -> DocumentFormat.OpenXml.Packaging.WordprocessingDocument
Public Shared Function Create (stream As Stream, type As WordprocessingDocumentType) As WordprocessingDocument

Parameters

stream
Stream

The IO stream on which to create the WordprocessingDocument.

type
WordprocessingDocumentType

The type of the WordprocessingDocument.

Returns

A new instance of WordprocessingDocument.

Exceptions

Thrown when "stream" is null reference.

Thrown when "stream" is not opened with Write access.

Applies to

Create(String, WordprocessingDocumentType)

Creates a new instance of the WordprocessingDocument class from the specified file.

public static DocumentFormat.OpenXml.Packaging.WordprocessingDocument Create (string path, DocumentFormat.OpenXml.WordprocessingDocumentType type);
static member Create : string * DocumentFormat.OpenXml.WordprocessingDocumentType -> DocumentFormat.OpenXml.Packaging.WordprocessingDocument
Public Shared Function Create (path As String, type As WordprocessingDocumentType) As WordprocessingDocument

Parameters

path
String

The path and file name of the target WordprocessingDocument.

type
WordprocessingDocumentType

The type of the WordprocessingDocument.

Returns

A new instance of WordprocessingDocument.

Exceptions

Thrown when "path" is null reference.

Applies to

Create(Package, WordprocessingDocumentType, Boolean)

Creates a new instance of the WordprocessingDocument class from the specified package.

public static DocumentFormat.OpenXml.Packaging.WordprocessingDocument Create (System.IO.Packaging.Package package, DocumentFormat.OpenXml.WordprocessingDocumentType type, bool autoSave);
static member Create : System.IO.Packaging.Package * DocumentFormat.OpenXml.WordprocessingDocumentType * bool -> DocumentFormat.OpenXml.Packaging.WordprocessingDocument
Public Shared Function Create (package As Package, type As WordprocessingDocumentType, autoSave As Boolean) As WordprocessingDocument

Parameters

package
Package

The specified OpenXml package

type
WordprocessingDocumentType

The type of the WordprocessingDocument.

autoSave
Boolean

Whether to auto save the created document.

Returns

A new instance of WordprocessingDocument.

Exceptions

Thrown when "package" is null reference.

Thrown when "package" is not opened with Write access.

Applies to

Create(Stream, WordprocessingDocumentType, Boolean)

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

public static DocumentFormat.OpenXml.Packaging.WordprocessingDocument Create (System.IO.Stream stream, DocumentFormat.OpenXml.WordprocessingDocumentType type, bool autoSave);
static member Create : System.IO.Stream * DocumentFormat.OpenXml.WordprocessingDocumentType * bool -> DocumentFormat.OpenXml.Packaging.WordprocessingDocument
Public Shared Function Create (stream As Stream, type As WordprocessingDocumentType, autoSave As Boolean) As WordprocessingDocument

Parameters

stream
Stream

The IO stream on which to create the WordprocessingDocument.

type
WordprocessingDocumentType

The type of the WordprocessingDocument.

autoSave
Boolean

Whether to auto save the created document.

Returns

A new instance of WordprocessingDocument.

Exceptions

Thrown when "stream" is null reference.

Thrown when "stream" is not opened with Write access.

Applies to

Create(String, WordprocessingDocumentType, Boolean)

Creates a new instance of the WordprocessingDocument class from the specified file.

public static DocumentFormat.OpenXml.Packaging.WordprocessingDocument Create (string path, DocumentFormat.OpenXml.WordprocessingDocumentType type, bool autoSave);
static member Create : string * DocumentFormat.OpenXml.WordprocessingDocumentType * bool -> DocumentFormat.OpenXml.Packaging.WordprocessingDocument
Public Shared Function Create (path As String, type As WordprocessingDocumentType, autoSave As Boolean) As WordprocessingDocument

Parameters

path
String

The path and file name of the target WordprocessingDocument.

type
WordprocessingDocumentType

The type of the WordprocessingDocument.

autoSave
Boolean

Whether to auto save the created document.

Returns

A new instance of WordprocessingDocument.

Exceptions

Thrown when "path" is null reference.

Applies to