OpenXmlPackage Class

Definition

Represents a base class for strong typed Open XML document classes.

public abstract class OpenXmlPackage : DocumentFormat.OpenXml.Packaging.OpenXmlPartContainer, IDisposable
type OpenXmlPackage = class
    inherit OpenXmlPartContainer
    interface IDisposable
Public MustInherit Class OpenXmlPackage
Inherits OpenXmlPartContainer
Implements IDisposable
Inheritance
OpenXmlPackage
Derived
Implements

Constructors

OpenXmlPackage()

Initializes a new instance of the OpenXmlPackage class.

Properties

AutoSave

Gets a flag that indicates whether the parts should be saved when disposed.

CompressionOption

Gets or sets the compression level for the content of the new part.

DataPartReferenceRelationships

Enumerates all DataPartReferenceRelationship relationships.

(Inherited from OpenXmlPartContainer)
DataParts

Enumerates all the DataPart parts in the document package.

ExternalRelationships

Enumerates all external relationships. Hyperlink relationships are not included, use HyperlinkRelationship property to enumerate hyperlink relationships.

(Inherited from OpenXmlPartContainer)
FileOpenAccess

Gets the FileAccess setting for the document. The current I/O access settings are: Read, Write, or ReadWrite.

HyperlinkRelationships

Enumerates all hyperlink relationships.

(Inherited from OpenXmlPartContainer)
MarkupCompatibilityProcessSettings

Gets the markup compatibility settings applied at loading time.

MaxCharactersInPart

Gets or sets a value that indicates the maximum allowable number of characters in an Open XML part. A zero (0) value indicates that there are no limits on the size of the part. A non-zero value specifies the maximum size, in characters.

Package

Gets the package of the document.

PackageProperties

Gets the core package properties of the Open XML document.

PartExtensionProvider

Gets a PartExtensionProvider part which provides a mapping from ContentType to part extension.

Parts

Enumerates all parts which are relationship targets of this part.

(Inherited from OpenXmlPartContainer)

Methods

AddAnnotation(Object)

Adds an object to the annotation list of this PartContainer.

(Inherited from OpenXmlPartContainer)
AddExtendedPart(String, String, String)

Adds an extended part ( Application specific part ).

(Inherited from OpenXmlPartContainer)
AddExtendedPart(String, String, String, String)

Adds an extended part ( Application specific part ).

(Inherited from OpenXmlPartContainer)
AddExternalRelationship(String, Uri)

Adds an external relationship. Do not add hyperlink relationships through this method. Use AddHyperlinkRelationship() instead.

(Inherited from OpenXmlPartContainer)
AddExternalRelationship(String, Uri, String)

Adds an external relationship. Do not add hyperlink relationships through this method. Use AddHyperlinkRelationship() instead.

(Inherited from OpenXmlPartContainer)
AddHyperlinkRelationship(Uri, Boolean)

Adds a new hyperlink relationship.

(Inherited from OpenXmlPartContainer)
AddHyperlinkRelationship(Uri, Boolean, String)

Adds a new hyperlink relationship.

(Inherited from OpenXmlPartContainer)
AddNewPart<T>()

Adds a new part of type T.

(Inherited from OpenXmlPartContainer)
AddNewPart<T>(String)

Adds a new part of type T.

(Inherited from OpenXmlPartContainer)
AddNewPart<T>(String, String)

Adds a new part of type T.

(Inherited from OpenXmlPartContainer)
AddPart<T>(T)

Adds the specified part to the document. Use the returned part to operate on the part added to the document.

AddPart<T>(T, String)

Adds the part to the document with a given relationship identifier (ID). Must use the returned part to operate on the part added to the document

(Inherited from OpenXmlPartContainer)
Annotation(Type)

Get the first annotation object of the specified type from this PartContainer.

(Inherited from OpenXmlPartContainer)
Annotation<T>()

Get the first annotation object of the specified type from this PartContainer.

(Inherited from OpenXmlPartContainer)
Annotations(Type)

Gets a collection of annotations of the specified type for this PartContainer.

(Inherited from OpenXmlPartContainer)
Annotations<T>()

Gets a collection of annotations of the specified type for this PartContainer.

(Inherited from OpenXmlPartContainer)
ChangeIdOfPart(OpenXmlPart, String)

Changes the relationship ID of the part.

(Inherited from OpenXmlPartContainer)
Clone()

Creates an editable clone of this OpenXml package, opened on a MemoryStream with expandable capacity and using default OpenSettings.

Clone(Package)

Creates a clone of this OpenXml package, opened on the specified instance of Package. The clone will be opened with the same OpenSettings as this OpenXml package.

Clone(Package, OpenSettings)

Creates a clone of this OpenXml package, opened on the specified instance of Package.

Clone(Stream)

Creates a clone of this OpenXml package, opened on the given stream. The cloned OpenXml package is opened with the same settings, i.e., FileOpenAccess and OpenSettings, as this OpenXml package.

Clone(Stream, Boolean)

Creates a clone of this OpenXml package, opened on the given stream. The cloned OpenXml package is opened with the same OpenSettings as this OpenXml package.

Clone(Stream, Boolean, OpenSettings)

Creates a clone of this OpenXml package, opened on the given stream.

Clone(String)

Creates a clone of this OpenXml package opened from the given file (which will be created by cloning this OpenXml package). The cloned OpenXml package is opened with the same settings, i.e., FileOpenAccess and OpenSettings, as this OpenXml package.

Clone(String, Boolean)

Creates a clone of this OpenXml package opened from the given file (which will be created by cloning this OpenXml package). The cloned OpenXml package is opened with the same OpenSettings as this OpenXml package.

Clone(String, Boolean, OpenSettings)

Creates a clone of this OpenXml package opened from the given file (which will be created by cloning this OpenXml package).

Close()

Saves and closes the OpenXml package and all underlying part streams.

CreateClone(Package)

Creates a new instance of OpenXmlPackage on the specified instance of Package.

CreateClone(Stream)

Creates a new OpenXmlPackage on the given stream.

CreateClone(String)

Creates a new OpenXml package on the given file.

CreateMediaDataPart(MediaDataPartType)

Creates a new MediaDataPart part in the document package.

CreateMediaDataPart(String)

Creates a new MediaDataPart part in the document package.

CreateMediaDataPart(String, String)

Creates a new MediaDataPart part in the document package.

CreateRelationshipToPart(OpenXmlPart)

Adds a relationship for the specified part to this part.

(Inherited from OpenXmlPartContainer)
CreateRelationshipToPart(OpenXmlPart, String)

Adds a relationship for the specified part to this part.

(Inherited from OpenXmlPartContainer)
DeleteExternalRelationship(ExternalRelationship)

Deletes the specified external relationship.

(Inherited from OpenXmlPartContainer)
DeleteExternalRelationship(String)

Deletes the specified ExternalRelationship.

(Inherited from OpenXmlPartContainer)
DeletePart(DataPart)

Deletes the specified DataPart from the document package.

DeletePart(OpenXmlPart)

Deletes a specified part in the package root layer.

(Inherited from OpenXmlPartContainer)
DeletePart(String)

Deletes the specified child part from this part.

(Inherited from OpenXmlPartContainer)
DeleteParts<T>(IEnumerable<T>)

Deletes all the parts which are in the passed in collection from the document.

(Inherited from OpenXmlPartContainer)
DeletePartsRecursivelyOfType<T>()

Deletes all the parts with the specified part type from the package recursively.

DeleteReferenceRelationship(ReferenceRelationship)

Deletes the specified reference relationship.

(Inherited from OpenXmlPartContainer)
DeleteReferenceRelationship(String)

Deletes the specified reference relationship.

(Inherited from OpenXmlPartContainer)
Dispose()

Flushes and saves the content, closes the document, and releases all resources.

Dispose(Boolean)

Flushes and saves the content, closes the document, and releases all resources.

FromFlatOpcDocumentCore(XDocument, Package)

Converts an XDocument in Flat OPC format to an OpenXml package stored in a Package.

FromFlatOpcDocumentCore(XDocument, Stream)

Converts an XDocument in Flat OPC format to an OpenXml package stored on a Stream.

FromFlatOpcDocumentCore(XDocument, String)

Converts an XDocument in Flat OPC format to an OpenXml package stored in a file.

GetExternalRelationship(String)

Gets the specified ExternalRelationship.

(Inherited from OpenXmlPartContainer)
GetIdOfPart(OpenXmlPart)

Gets the relationship ID of the part.

(Inherited from OpenXmlPartContainer)
GetPartById(String)

Gets the child part through the relationship ID.

(Inherited from OpenXmlPartContainer)
GetPartsCountOfType<T>()

Gets the count of all parts of type T.

(Inherited from OpenXmlPartContainer)
GetPartsOfType<T>()

Enumerates all the children parts of the specified type "T" of this part.

(Inherited from OpenXmlPartContainer)
GetPartsOfType<T>(ICollection<T>)

Gets all the children parts of the specified type "T" into "partCollection" of this part.

(Inherited from OpenXmlPartContainer)
GetReferenceRelationship(String)

Gets the specified ReferenceRelationship.

(Inherited from OpenXmlPartContainer)
OpenClone(Stream, Boolean, OpenSettings)

Opens the cloned OpenXml package on the given stream.

OpenClone(String, Boolean, OpenSettings)

Opens the cloned OpenXml package on the given file.

RemoveAnnotations(Type)

Removes the annotations of the specified type from this PartContainer.

(Inherited from OpenXmlPartContainer)
RemoveAnnotations<T>()

Removes the annotations of the specified type from this PartContainer.

(Inherited from OpenXmlPartContainer)
Save()

Saves the contents of all parts and relationships that are contained in the OpenXml package, if FileOpenAccess is ReadWrite.

SaveAs(String)

Saves the contents of all parts and relationships that are contained in the OpenXml package to the specified file. Opens the saved document using the same settings that were used to open this OpenXml package.

ThrowIfObjectDisposed()

Thrown if an object is disposed.

ToFlatOpcDocument()

Converts an OpenXml package in OPC format to an XDocument in Flat OPC format.

ToFlatOpcDocument(XProcessingInstruction)

Converts an OpenXml package in OPC format to an XDocument in Flat OPC format.

ToFlatOpcString()

Converts an OpenXml package in OPC format to string in Flat OPC format.

Validate(OpenXmlPackageValidationSettings)
Obsolete.

Validates the package. This method does not validate the XML content in each part.

Applies to