# OfficeDoc Class

The OfficeDoc class implements support for the Open XML Packaging Format used in Office 2007 documents.

## Class Name

**IPWorksZip_OfficeDoc**

## Procedural Interface

```text
 ipworkszip_officedoc_open();
 ipworkszip_officedoc_close($res);
 ipworkszip_officedoc_register_callback($res, $id, $function);
 ipworkszip_officedoc_get_last_error($res);
 ipworkszip_officedoc_get_last_error_code($res);
 ipworkszip_officedoc_set($res, $id, $index, $value);
 ipworkszip_officedoc_get($res, $id, $index);
 ipworkszip_officedoc_do_close($res);
 ipworkszip_officedoc_do_config($res, $configurationstring);
 ipworkszip_officedoc_do_extractpart($res);
 ipworkszip_officedoc_do_findpartbytype($res, $typeuri);
 ipworkszip_officedoc_do_getpropertyvalue($res, $propname, $propnamespace);
 ipworkszip_officedoc_do_listparts($res);
 ipworkszip_officedoc_do_open($res);
 ipworkszip_officedoc_do_parsepart($res);
 ipworkszip_officedoc_do_readrelationships($res);
 ipworkszip_officedoc_do_replacepart($res);
 ipworkszip_officedoc_do_reset($res);
 ipworkszip_officedoc_do_resolvecontenttype($res);
```

## Remarks

The class provides a way to extract information and content from an Open XML packaged document, examine the package properties and basic read/update facilities.

## Property List

*The following is the full list of the properties of the class with short descriptions. Click on the links for further details.*

|  |  |
| --- | --- |
| [ContentTypeCount](#contenttypecount-property-ipworkszip_officedoc-class) | The number of records in the ContentType arrays. |
| [ContentTypeIsOverride](#contenttypeisoverride-property-ipworkszip_officedoc-class) | Specifies if this is a default content type or an override. |
| [ContentTypeMediaType](#contenttypemediatype-property-ipworkszip_officedoc-class) | The media type for this entry, as defined by RFC2616. |
| [ContentTypeTarget](#contenttypetarget-property-ipworkszip_officedoc-class) | If it's a default content type, this will be the file extension it applies to. |
| [NamespaceCount](#namespacecount-property-ipworkszip_officedoc-class) | The number of records in the Namespace arrays. |
| [NamespacePrefix](#namespaceprefix-property-ipworkszip_officedoc-class) | This property contains the Prefix for the namespace. |
| [NamespaceURI](#namespaceuri-property-ipworkszip_officedoc-class) | This property contains the namespace URI associated with the corresponding Prefix . |
| [PackagePath](#packagepath-property-ipworkszip_officedoc-class) | The path to the Open XML package file. |
| [PackagePropertyCount](#packagepropertycount-property-ipworkszip_officedoc-class) | The number of records in the PackageProperty arrays. |
| [PackagePropertyDataType](#packagepropertydatatype-property-ipworkszip_officedoc-class) | The data type associated with this property, if the information is available. |
| [PackagePropertyName](#packagepropertyname-property-ipworkszip_officedoc-class) | The name of this property. |
| [PackagePropertyNamespace](#packagepropertynamespace-property-ipworkszip_officedoc-class) | The XML Namespace URI associated with this property. |
| [PackagePropertyPropId](#packagepropertypropid-property-ipworkszip_officedoc-class) | If this is a custom property, this will be the pid assigned to it. |
| [PackagePropertyPropSet](#packagepropertypropset-property-ipworkszip_officedoc-class) | If this is a custom property, this will be the GUID of the property set it belongs to. |
| [PackagePropertyValue](#packagepropertyvalue-property-ipworkszip_officedoc-class) | The value of this property. |
| [PartData](#partdata-property-ipworkszip_officedoc-class) | The contents of the currently selected part. |
| [PartName](#partname-property-ipworkszip_officedoc-class) | The name of the currently selected part. |
| [RelationshipCount](#relationshipcount-property-ipworkszip_officedoc-class) | The number of records in the Relationship arrays. |
| [RelationshipContentType](#relationshipcontenttype-property-ipworkszip_officedoc-class) | The content type for the part referenced by this relationship, resolved from [Content_Types]. |
| [RelationshipId](#relationshipid-property-ipworkszip_officedoc-class) | The unique ID of this relationship within this . |
| [RelationshipPartName](#relationshippartname-property-ipworkszip_officedoc-class) | The name of the part this relationship entry applies to. |
| [RelationshipTypeURI](#relationshiptypeuri-property-ipworkszip_officedoc-class) | The XML namespace URI that specifies the meaning of this relationship. |
| [Validate](#validate-property-ipworkszip_officedoc-class) | This property controls whether documents are validated during parsing. |
| [AttrCount](#attrcount-property-ipworkszip_officedoc-class) | The number of records in the Attr arrays. |
| [AttrName](#attrname-property-ipworkszip_officedoc-class) | The Name provides the local name (without prefix) of the attribute. |
| [AttrNamespace](#attrnamespace-property-ipworkszip_officedoc-class) | This property contains the attribute namespace. |
| [AttrPrefix](#attrprefix-property-ipworkszip_officedoc-class) | This property contains the attribute prefix (if any). |
| [AttrValue](#attrvalue-property-ipworkszip_officedoc-class) | This property contains the attribute value. |
| [XChildCount](#xchildcount-property-ipworkszip_officedoc-class) | The number of records in the XChild arrays. |
| [XChildName](#xchildname-property-ipworkszip_officedoc-class) | The Name property provides the local name (without a prefix) of the element. |
| [XChildNamespace](#xchildnamespace-property-ipworkszip_officedoc-class) | This property contains the namespace of the element. |
| [XChildPrefix](#xchildprefix-property-ipworkszip_officedoc-class) | This property contains the prefix of the element (if any). |
| [XChildXText](#xchildxtext-property-ipworkszip_officedoc-class) | This property contains the inner text of the element. |
| [XElement](#xelement-property-ipworkszip_officedoc-class) | The name of the current element. |
| [XNamespace](#xnamespace-property-ipworkszip_officedoc-class) | The namespace of the current element. |
| [XParent](#xparent-property-ipworkszip_officedoc-class) | This property includes the parent of the current element. |
| [XPath](#xpath-property-ipworkszip_officedoc-class) | This property provides a way to point to a specific element in the document. |
| [XPrefix](#xprefix-property-ipworkszip_officedoc-class) | The prefix of the current element. |
| [XSubTree](#xsubtree-property-ipworkszip_officedoc-class) | This property includes a snapshot of the current element in the document. |
| [XText](#xtext-property-ipworkszip_officedoc-class) | The text of the current element. |

## Method List

*The following is the full list of the methods of the class with short descriptions. Click on the links for further details.*

|  |  |
| --- | --- |
| [Close](#close-method-ipworkszip_officedoc-class) | Closes the Open XML package archive. |
| [Config](#config-method-ipworkszip_officedoc-class) | Sets or retrieves a configuration setting. |
| [ExtractPart](#extractpart-method-ipworkszip_officedoc-class) | Reads the contents of the currently selected part. |
| [FindPartByType](#findpartbytype-method-ipworkszip_officedoc-class) | Looks up a part in the current relationships file by it's type namespace URI. |
| [GetPropertyValue](#getpropertyvalue-method-ipworkszip_officedoc-class) | Returns the value of the specified package property. |
| [ListParts](#listparts-method-ipworkszip_officedoc-class) | List all the parts contained in the document and their relationships. |
| [Open](#open-method-ipworkszip_officedoc-class) | Opens the Open XML package archive. |
| [ParsePart](#parsepart-method-ipworkszip_officedoc-class) | Parses the specified part as XML. |
| [ReadRelationships](#readrelationships-method-ipworkszip_officedoc-class) | Reads the relationships file in the archive associated with the specified part. |
| [ReplacePart](#replacepart-method-ipworkszip_officedoc-class) | Replaces the contents of the specified part in the package. |
| [Reset](#reset-method-ipworkszip_officedoc-class) | Resets the class. |
| [ResolveContentType](#resolvecontenttype-method-ipworkszip_officedoc-class) | Returns the content type of the specified part. |

## Event List

*The following is the full list of the events fired by the class with short descriptions. Click on the links for further details.*

|  |  |
| --- | --- |
| [BeginFile](#beginfile-event-ipworkszip_officedoc-class) | Fired before each file is processed. |
| [Characters](#characters-event-ipworkszip_officedoc-class) | This event is fired for plaintext segments of the input stream. |
| [Comment](#comment-event-ipworkszip_officedoc-class) | This event is fired when a comment section is encountered. |
| [EndElement](#endelement-event-ipworkszip_officedoc-class) | This event is fired when an end-element tag is encountered. |
| [EndFile](#endfile-event-ipworkszip_officedoc-class) | Fired after each file is processed. |
| [EndPrefixMapping](#endprefixmapping-event-ipworkszip_officedoc-class) | This event is fired when leaving the scope of a namespace declaration. |
| [Error](#error-event-ipworkszip_officedoc-class) | Fired when information is available about errors during data delivery. |
| [EvalEntity](#evalentity-event-ipworkszip_officedoc-class) | This event is fired every time an entity needs to be evaluated. |
| [IgnorableWhitespace](#ignorablewhitespace-event-ipworkszip_officedoc-class) | This event is fired when a section of ignorable whitespace is encountered. |
| [Meta](#meta-event-ipworkszip_officedoc-class) | This event fires when a meta section is encountered. |
| [Overwrite](#overwrite-event-ipworkszip_officedoc-class) | Fired whenever a file exists and may be overwritten. |
| [PI](#pi-event-ipworkszip_officedoc-class) | This event is fired when a processing instruction section is encountered. |
| [Progress](#progress-event-ipworkszip_officedoc-class) | Fired as progress is made. |
| [SpecialSection](#specialsection-event-ipworkszip_officedoc-class) | This event is fired when a special section is encountered. |
| [StartElement](#startelement-event-ipworkszip_officedoc-class) | This event is fired when a begin-element tag is encountered in the document. |
| [StartPrefixMapping](#startprefixmapping-event-ipworkszip_officedoc-class) | This event is fired when entering the scope of a namespace declaration. |

## Config Settings

*The following is a list of config settings for the class with short descriptions. Click on the links for further details.*

|  |  |
| --- | --- |
| [NormalizePartName](#NormalizePartName) | Whether to normalize Part Names. |
| [RelationshipIsExternal\[x\]](#RelationshipIsExternal[x]) | Whether the relationship part is internal or external. |
| [BuildInfo](#BuildInfo) | Information about the product's build. |
| [CodePage](#CodePage) | The system code page used for Unicode to Multibyte translations. |
| [LicenseInfo](#LicenseInfo) | Information about the current license. |
| [MaskSensitiveData](#MaskSensitiveData) | Whether sensitive data is masked in log messages. |
| [ProcessIdleEvents](#ProcessIdleEvents) | Whether the class uses its internal event loop to process events when the main thread is idle. |
| [SelectWaitMillis](#SelectWaitMillis) | The length of time in milliseconds the class will wait when DoEvents is called if there are no events to process. |
| [UseInternalSecurityAPI](#UseInternalSecurityAPI) | Whether or not to use the system security libraries or an internal implementation. |

# ContentTypeCount Property ([IPWorksZip_OfficeDoc](#officedoc-class) Class)

The number of records in the ContentType arrays.

## Object Oriented Interface

```text
public function getContentTypeCount();
```

## Procedural Interface

```text
ipworkszip_officedoc_get($res, 1 );
```

## Default Value

0

## Remarks

This property controls the size of the following arrays:

- [ContentTypeIsOverride](#contenttypeisoverride-property-ipworkszip_officedoc-class)
- [ContentTypeMediaType](#contenttypemediatype-property-ipworkszip_officedoc-class)
- [ContentTypeTarget](#contenttypetarget-property-ipworkszip_officedoc-class)

The array indices start at *0* and end at *ContentTypeCount - 1*.

This property is read-only and not available at design time.

## Data Type

Integer

# ContentTypeIsOverride Property ([IPWorksZip_OfficeDoc](#officedoc-class) Class)

Specifies if this is a default content type or an override.

## Object Oriented Interface

```text
public function getContentTypeIsOverride($contenttypeindex);
```

## Procedural Interface

```text
ipworkszip_officedoc_get($res, 2 , $contenttypeindex);
```

## Default Value

true

## Remarks

Specifies if this is a default content type or an override.

The *$contenttypeindex* parameter specifies the index of the item in the array. The size of the array is controlled by the [ContentTypeCount](#contenttypecount-property-ipworkszip_officedoc-class) property.

This property is read-only and not available at design time.

## Data Type

Boolean

# ContentTypeMediaType Property ([IPWorksZip_OfficeDoc](#officedoc-class) Class)

The media type for this entry, as defined by RFC2616.

## Object Oriented Interface

```text
public function getContentTypeMediaType($contenttypeindex);
```

## Procedural Interface

```text
ipworkszip_officedoc_get($res, 3 , $contenttypeindex);
```

## Default Value

''

## Remarks

The media type for this entry, as defined by RFC2616.

The *$contenttypeindex* parameter specifies the index of the item in the array. The size of the array is controlled by the [ContentTypeCount](#contenttypecount-property-ipworkszip_officedoc-class) property.

This property is read-only and not available at design time.

## Data Type

String

# ContentTypeTarget Property ([IPWorksZip_OfficeDoc](#officedoc-class) Class)

If it's a default content type, this will be the file extension it applies to.

## Object Oriented Interface

```text
public function getContentTypeTarget($contenttypeindex);
```

## Procedural Interface

```text
ipworkszip_officedoc_get($res, 4 , $contenttypeindex);
```

## Default Value

''

## Remarks

If it's a default content type, this will be the file extension it applies to. Otherwise, it will be the part name.

The *$contenttypeindex* parameter specifies the index of the item in the array. The size of the array is controlled by the [ContentTypeCount](#contenttypecount-property-ipworkszip_officedoc-class) property.

This property is read-only and not available at design time.

## Data Type

String

# NamespaceCount Property ([IPWorksZip_OfficeDoc](#officedoc-class) Class)

The number of records in the Namespace arrays.

## Object Oriented Interface

```text
public function getNamespaceCount();
```

## Procedural Interface

```text
ipworkszip_officedoc_get($res, 5 );
```

## Default Value

0

## Remarks

This property controls the size of the following arrays:

- [NamespacePrefix](#namespaceprefix-property-ipworkszip_officedoc-class)
- [NamespaceURI](#namespaceuri-property-ipworkszip_officedoc-class)

The array indices start at *0* and end at *NamespaceCount - 1*.

This property is read-only and not available at design time.

## Data Type

Integer

# NamespacePrefix Property ([IPWorksZip_OfficeDoc](#officedoc-class) Class)

This property contains the Prefix for the namespace.

## Object Oriented Interface

```text
public function getNamespacePrefix($namespaceindex);
```

## Procedural Interface

```text
ipworkszip_officedoc_get($res, 6 , $namespaceindex);
```

## Default Value

''

## Remarks

This property contains the [NamespacePrefix](#namespaceprefix-property-ipworkszip_officedoc-class) for the namespace.

The *$namespaceindex* parameter specifies the index of the item in the array. The size of the array is controlled by the [NamespaceCount](#namespacecount-property-ipworkszip_officedoc-class) property.

This property is read-only and not available at design time.

## Data Type

String

# NamespaceURI Property ([IPWorksZip_OfficeDoc](#officedoc-class) Class)

This property contains the namespace URI associated with the corresponding Prefix .

## Object Oriented Interface

```text
public function getNamespaceURI($namespaceindex);
```

## Procedural Interface

```text
ipworkszip_officedoc_get($res, 7 , $namespaceindex);
```

## Default Value

''

## Remarks

This property contains the namespace URI associated with the corresponding [NamespacePrefix](#namespaceprefix-property-ipworkszip_officedoc-class). This URL is usually pointing to the XML schema for the namespace.

The *$namespaceindex* parameter specifies the index of the item in the array. The size of the array is controlled by the [NamespaceCount](#namespacecount-property-ipworkszip_officedoc-class) property.

This property is read-only and not available at design time.

## Data Type

String

# PackagePath Property ([IPWorksZip_OfficeDoc](#officedoc-class) Class)

The path to the Open XML package file.

## Object Oriented Interface

```text
public function getPackagePath();
public function setPackagePath($value);
```

## Procedural Interface

```text
ipworkszip_officedoc_get($res, 8 );
ipworkszip_officedoc_set($res, 8, $value );
```

## Default Value

''

## Remarks

This property specifies the path and filename of the Open XML package to work on.

## Data Type

String

# PackagePropertyCount Property ([IPWorksZip_OfficeDoc](#officedoc-class) Class)

The number of records in the PackageProperty arrays.

## Object Oriented Interface

```text
public function getPackagePropertyCount();
```

## Procedural Interface

```text
ipworkszip_officedoc_get($res, 9 );
```

## Default Value

0

## Remarks

This property controls the size of the following arrays:

- [PackagePropertyDataType](#packagepropertydatatype-property-ipworkszip_officedoc-class)
- [PackagePropertyName](#packagepropertyname-property-ipworkszip_officedoc-class)
- [PackagePropertyNamespace](#packagepropertynamespace-property-ipworkszip_officedoc-class)
- [PackagePropertyPropId](#packagepropertypropid-property-ipworkszip_officedoc-class)
- [PackagePropertyPropSet](#packagepropertypropset-property-ipworkszip_officedoc-class)
- [PackagePropertyValue](#packagepropertyvalue-property-ipworkszip_officedoc-class)

The array indices start at *0* and end at *PackagePropertyCount - 1*.

This property is read-only and not available at design time.

## Data Type

Integer

# PackagePropertyDataType Property ([IPWorksZip_OfficeDoc](#officedoc-class) Class)

The data type associated with this property, if the information is available.

## Object Oriented Interface

```text
public function getPackagePropertyDataType($packagepropertyindex);
```

## Procedural Interface

```text
ipworkszip_officedoc_get($res, 10 , $packagepropertyindex);
```

## Default Value

''

## Remarks

The data type associated with this property, if the information is available.

The *$packagepropertyindex* parameter specifies the index of the item in the array. The size of the array is controlled by the [PackagePropertyCount](#packagepropertycount-property-ipworkszip_officedoc-class) property.

This property is read-only and not available at design time.

## Data Type

String

# PackagePropertyName Property ([IPWorksZip_OfficeDoc](#officedoc-class) Class)

The name of this property.

## Object Oriented Interface

```text
public function getPackagePropertyName($packagepropertyindex);
```

## Procedural Interface

```text
ipworkszip_officedoc_get($res, 11 , $packagepropertyindex);
```

## Default Value

''

## Remarks

The name of this property

The *$packagepropertyindex* parameter specifies the index of the item in the array. The size of the array is controlled by the [PackagePropertyCount](#packagepropertycount-property-ipworkszip_officedoc-class) property.

This property is read-only and not available at design time.

## Data Type

String

# PackagePropertyNamespace Property ([IPWorksZip_OfficeDoc](#officedoc-class) Class)

The XML Namespace URI associated with this property.

## Object Oriented Interface

```text
public function getPackagePropertyNamespace($packagepropertyindex);
```

## Procedural Interface

```text
ipworkszip_officedoc_get($res, 12 , $packagepropertyindex);
```

## Default Value

''

## Remarks

The XML Namespace URI associated with this property. For custom properties, this will be an empty string.

The *$packagepropertyindex* parameter specifies the index of the item in the array. The size of the array is controlled by the [PackagePropertyCount](#packagepropertycount-property-ipworkszip_officedoc-class) property.

This property is read-only and not available at design time.

## Data Type

String

# PackagePropertyPropId Property ([IPWorksZip_OfficeDoc](#officedoc-class) Class)

If this is a custom property, this will be the pid assigned to it.

## Object Oriented Interface

```text
public function getPackagePropertyPropId($packagepropertyindex);
```

## Procedural Interface

```text
ipworkszip_officedoc_get($res, 13 , $packagepropertyindex);
```

## Default Value

''

## Remarks

If this is a custom property, this will be the pid assigned to it.

The *$packagepropertyindex* parameter specifies the index of the item in the array. The size of the array is controlled by the [PackagePropertyCount](#packagepropertycount-property-ipworkszip_officedoc-class) property.

This property is read-only and not available at design time.

## Data Type

String

# PackagePropertyPropSet Property ([IPWorksZip_OfficeDoc](#officedoc-class) Class)

If this is a custom property, this will be the GUID of the property set it belongs to.

## Object Oriented Interface

```text
public function getPackagePropertyPropSet($packagepropertyindex);
```

## Procedural Interface

```text
ipworkszip_officedoc_get($res, 14 , $packagepropertyindex);
```

## Default Value

''

## Remarks

If this is a custom property, this will be the GUID of the property set it belongs to.

The *$packagepropertyindex* parameter specifies the index of the item in the array. The size of the array is controlled by the [PackagePropertyCount](#packagepropertycount-property-ipworkszip_officedoc-class) property.

This property is read-only and not available at design time.

## Data Type

String

# PackagePropertyValue Property ([IPWorksZip_OfficeDoc](#officedoc-class) Class)

The value of this property.

## Object Oriented Interface

```text
public function getPackagePropertyValue($packagepropertyindex);
```

## Procedural Interface

```text
ipworkszip_officedoc_get($res, 15 , $packagepropertyindex);
```

## Default Value

''

## Remarks

The value of this property

The *$packagepropertyindex* parameter specifies the index of the item in the array. The size of the array is controlled by the [PackagePropertyCount](#packagepropertycount-property-ipworkszip_officedoc-class) property.

This property is read-only and not available at design time.

## Data Type

String

# PartData Property ([IPWorksZip_OfficeDoc](#officedoc-class) Class)

The contents of the currently selected part.

## Object Oriented Interface

```text
public function getPartData();
public function setPartData($value);
```

## Procedural Interface

```text
ipworkszip_officedoc_get($res, 16 );
ipworkszip_officedoc_set($res, 16, $value );
```

## Default Value

''

## Remarks

This property will hold the contents of the part selected by [PartName](#partname-property-ipworkszip_officedoc-class) after calling the [ExtractPart](#extractpart-method-ipworkszip_officedoc-class) method. It can also be set before calling [ReplacePart](#replacepart-method-ipworkszip_officedoc-class).

## Data Type

Binary String

# PartName Property ([IPWorksZip_OfficeDoc](#officedoc-class) Class)

The name of the currently selected part.

## Object Oriented Interface

```text
public function getPartName();
public function setPartName($value);
```

## Procedural Interface

```text
ipworkszip_officedoc_get($res, 17 );
ipworkszip_officedoc_set($res, 17, $value );
```

## Default Value

''

## Remarks

This property specifies the name of the currently selected part in the document. If null or empty, no part is currently selected.

## Data Type

String

# RelationshipCount Property ([IPWorksZip_OfficeDoc](#officedoc-class) Class)

The number of records in the Relationship arrays.

## Object Oriented Interface

```text
public function getRelationshipCount();
```

## Procedural Interface

```text
ipworkszip_officedoc_get($res, 18 );
```

## Default Value

0

## Remarks

This property controls the size of the following arrays:

- [RelationshipContentType](#relationshipcontenttype-property-ipworkszip_officedoc-class)
- [RelationshipId](#relationshipid-property-ipworkszip_officedoc-class)
- [RelationshipPartName](#relationshippartname-property-ipworkszip_officedoc-class)
- [RelationshipTypeURI](#relationshiptypeuri-property-ipworkszip_officedoc-class)

The array indices start at *0* and end at *RelationshipCount - 1*.

This property is read-only and not available at design time.

## Data Type

Integer

# RelationshipContentType Property ([IPWorksZip_OfficeDoc](#officedoc-class) Class)

The content type for the part referenced by this relationship, resolved from [Content_Types].

## Object Oriented Interface

```text
public function getRelationshipContentType($relationshipindex);
```

## Procedural Interface

```text
ipworkszip_officedoc_get($res, 19 , $relationshipindex);
```

## Default Value

''

## Remarks

The content type for the part referenced by this relationship, resolved from [Content_Types].xml according to the Open XML packaging specification rules.

The *$relationshipindex* parameter specifies the index of the item in the array. The size of the array is controlled by the [RelationshipCount](#relationshipcount-property-ipworkszip_officedoc-class) property.

This property is read-only and not available at design time.

## Data Type

String

# RelationshipId Property ([IPWorksZip_OfficeDoc](#officedoc-class) Class)

The unique ID of this relationship within this .

## Object Oriented Interface

```text
public function getRelationshipId($relationshipindex);
```

## Procedural Interface

```text
ipworkszip_officedoc_get($res, 20 , $relationshipindex);
```

## Default Value

''

## Remarks

The unique ID of this relationship within this .rels file

The *$relationshipindex* parameter specifies the index of the item in the array. The size of the array is controlled by the [RelationshipCount](#relationshipcount-property-ipworkszip_officedoc-class) property.

This property is read-only and not available at design time.

## Data Type

String

# RelationshipPartName Property ([IPWorksZip_OfficeDoc](#officedoc-class) Class)

The name of the part this relationship entry applies to.

## Object Oriented Interface

```text
public function getRelationshipPartName($relationshipindex);
```

## Procedural Interface

```text
ipworkszip_officedoc_get($res, 21 , $relationshipindex);
```

## Default Value

''

## Remarks

The name of the part this relationship entry applies to.

The *$relationshipindex* parameter specifies the index of the item in the array. The size of the array is controlled by the [RelationshipCount](#relationshipcount-property-ipworkszip_officedoc-class) property.

This property is read-only and not available at design time.

## Data Type

String

# RelationshipTypeURI Property ([IPWorksZip_OfficeDoc](#officedoc-class) Class)

The XML namespace URI that specifies the meaning of this relationship.

## Object Oriented Interface

```text
public function getRelationshipTypeURI($relationshipindex);
```

## Procedural Interface

```text
ipworkszip_officedoc_get($res, 22 , $relationshipindex);
```

## Default Value

''

## Remarks

The XML namespace URI that specifies the meaning of this relationship.

The *$relationshipindex* parameter specifies the index of the item in the array. The size of the array is controlled by the [RelationshipCount](#relationshipcount-property-ipworkszip_officedoc-class) property.

This property is read-only and not available at design time.

## Data Type

String

# Validate Property ([IPWorksZip_OfficeDoc](#officedoc-class) Class)

This property controls whether documents are validated during parsing.

## Object Oriented Interface

```text
public function getValidate();
public function setValidate($value);
```

## Procedural Interface

```text
ipworkszip_officedoc_get($res, 23 );
ipworkszip_officedoc_set($res, 23, $value );
```

## Default Value

true

## Remarks

When *true* (default), the document will be validated during parsing. To disable validation set Validate to *false*. Disabling validation may be useful in cases in which data can still be parsed even if the document is not well formed.

## Data Type

Boolean

# AttrCount Property ([IPWorksZip_OfficeDoc](#officedoc-class) Class)

The number of records in the Attr arrays.

## Object Oriented Interface

```text
public function getAttrCount();
```

## Procedural Interface

```text
ipworkszip_officedoc_get($res, 24 );
```

## Default Value

0

## Remarks

This property controls the size of the following arrays:

- [AttrName](#attrname-property-ipworkszip_officedoc-class)
- [AttrNamespace](#attrnamespace-property-ipworkszip_officedoc-class)
- [AttrPrefix](#attrprefix-property-ipworkszip_officedoc-class)
- [AttrValue](#attrvalue-property-ipworkszip_officedoc-class)

The array indices start at *0* and end at *AttrCount - 1*.

This property is read-only and not available at design time.

## Data Type

Integer

# AttrName Property ([IPWorksZip_OfficeDoc](#officedoc-class) Class)

The Name provides the local name (without prefix) of the attribute.

## Object Oriented Interface

```text
public function getAttrName($attrindex);
```

## Procedural Interface

```text
ipworkszip_officedoc_get($res, 25 , $attrindex);
```

## Default Value

''

## Remarks

The [AttrName](#attrname-property-ipworkszip_officedoc-class) provides the local name (without prefix) of the attribute.

The *$attrindex* parameter specifies the index of the item in the array. The size of the array is controlled by the [AttrCount](#attrcount-property-ipworkszip_officedoc-class) property.

This property is read-only and not available at design time.

## Data Type

String

# AttrNamespace Property ([IPWorksZip_OfficeDoc](#officedoc-class) Class)

This property contains the attribute namespace.

## Object Oriented Interface

```text
public function getAttrNamespace($attrindex);
```

## Procedural Interface

```text
ipworkszip_officedoc_get($res, 26 , $attrindex);
```

## Default Value

''

## Remarks

This property contains the attribute namespace.

The *$attrindex* parameter specifies the index of the item in the array. The size of the array is controlled by the [AttrCount](#attrcount-property-ipworkszip_officedoc-class) property.

This property is read-only and not available at design time.

## Data Type

String

# AttrPrefix Property ([IPWorksZip_OfficeDoc](#officedoc-class) Class)

This property contains the attribute prefix (if any).

## Object Oriented Interface

```text
public function getAttrPrefix($attrindex);
```

## Procedural Interface

```text
ipworkszip_officedoc_get($res, 27 , $attrindex);
```

## Default Value

''

## Remarks

This property contains the attribute prefix (if any). If the attribute does not have a prefix, this property is empty.

The *$attrindex* parameter specifies the index of the item in the array. The size of the array is controlled by the [AttrCount](#attrcount-property-ipworkszip_officedoc-class) property.

This property is read-only and not available at design time.

## Data Type

String

# AttrValue Property ([IPWorksZip_OfficeDoc](#officedoc-class) Class)

This property contains the attribute value.

## Object Oriented Interface

```text
public function getAttrValue($attrindex);
```

## Procedural Interface

```text
ipworkszip_officedoc_get($res, 28 , $attrindex);
```

## Default Value

''

## Remarks

This property contains the attribute value.

The *$attrindex* parameter specifies the index of the item in the array. The size of the array is controlled by the [AttrCount](#attrcount-property-ipworkszip_officedoc-class) property.

This property is read-only and not available at design time.

## Data Type

String

# XChildCount Property ([IPWorksZip_OfficeDoc](#officedoc-class) Class)

The number of records in the XChild arrays.

## Object Oriented Interface

```text
public function getXChildCount();
```

## Procedural Interface

```text
ipworkszip_officedoc_get($res, 29 );
```

## Default Value

0

## Remarks

This property controls the size of the following arrays:

- [XChildName](#xchildname-property-ipworkszip_officedoc-class)
- [XChildNamespace](#xchildnamespace-property-ipworkszip_officedoc-class)
- [XChildPrefix](#xchildprefix-property-ipworkszip_officedoc-class)
- [XChildXText](#xchildxtext-property-ipworkszip_officedoc-class)

The array indices start at *0* and end at *XChildCount - 1*.

This property is read-only and not available at design time.

## Data Type

Integer

# XChildName Property ([IPWorksZip_OfficeDoc](#officedoc-class) Class)

The Name property provides the local name (without a prefix) of the element.

## Object Oriented Interface

```text
public function getXChildName($xchildindex);
```

## Procedural Interface

```text
ipworkszip_officedoc_get($res, 30 , $xchildindex);
```

## Default Value

''

## Remarks

The [XChildName](#xchildname-property-ipworkszip_officedoc-class) property provides the local name (without a prefix) of the element.

The *$xchildindex* parameter specifies the index of the item in the array. The size of the array is controlled by the [XChildCount](#xchildcount-property-ipworkszip_officedoc-class) property.

This property is read-only and not available at design time.

## Data Type

String

# XChildNamespace Property ([IPWorksZip_OfficeDoc](#officedoc-class) Class)

This property contains the namespace of the element.

## Object Oriented Interface

```text
public function getXChildNamespace($xchildindex);
```

## Procedural Interface

```text
ipworkszip_officedoc_get($res, 31 , $xchildindex);
```

## Default Value

''

## Remarks

This property contains the namespace of the element.

The *$xchildindex* parameter specifies the index of the item in the array. The size of the array is controlled by the [XChildCount](#xchildcount-property-ipworkszip_officedoc-class) property.

This property is read-only and not available at design time.

## Data Type

String

# XChildPrefix Property ([IPWorksZip_OfficeDoc](#officedoc-class) Class)

This property contains the prefix of the element (if any).

## Object Oriented Interface

```text
public function getXChildPrefix($xchildindex);
```

## Procedural Interface

```text
ipworkszip_officedoc_get($res, 32 , $xchildindex);
```

## Default Value

''

## Remarks

This property contains the prefix of the element (if any). If the element does not have a prefix, this property is empty.

The *$xchildindex* parameter specifies the index of the item in the array. The size of the array is controlled by the [XChildCount](#xchildcount-property-ipworkszip_officedoc-class) property.

This property is read-only and not available at design time.

## Data Type

String

# XChildXText Property ([IPWorksZip_OfficeDoc](#officedoc-class) Class)

This property contains the inner text of the element.

## Object Oriented Interface

```text
public function getXChildXText($xchildindex);
```

## Procedural Interface

```text
ipworkszip_officedoc_get($res, 33 , $xchildindex);
```

## Default Value

''

## Remarks

This property contains the inner text of the element.

The *$xchildindex* parameter specifies the index of the item in the array. The size of the array is controlled by the [XChildCount](#xchildcount-property-ipworkszip_officedoc-class) property.

This property is read-only and not available at design time.

## Data Type

String

# XElement Property ([IPWorksZip_OfficeDoc](#officedoc-class) Class)

The name of the current element.

## Object Oriented Interface

```text
public function getXElement();
```

## Procedural Interface

```text
ipworkszip_officedoc_get($res, 34 );
```

## Default Value

''

## Remarks

The current element is specified via the [XPath](#xpath-property-ipworkszip_officedoc-class) property.

This property is read-only.

## Data Type

String

# XNamespace Property ([IPWorksZip_OfficeDoc](#officedoc-class) Class)

The namespace of the current element.

## Object Oriented Interface

```text
public function getXNamespace();
```

## Procedural Interface

```text
ipworkszip_officedoc_get($res, 35 );
```

## Default Value

''

## Remarks

The current element is specified via the [XPath](#xpath-property-ipworkszip_officedoc-class) property.

This property is read-only.

## Data Type

String

# XParent Property ([IPWorksZip_OfficeDoc](#officedoc-class) Class)

This property includes the parent of the current element.

## Object Oriented Interface

```text
public function getXParent();
```

## Procedural Interface

```text
ipworkszip_officedoc_get($res, 36 );
```

## Default Value

''

## Remarks

The current element is specified through the [XPath](#xpath-property-ipworkszip_officedoc-class) property.

This property is read-only.

## Data Type

String

# XPath Property ([IPWorksZip_OfficeDoc](#officedoc-class) Class)

This property provides a way to point to a specific element in the document.

## Object Oriented Interface

```text
public function getXPath();
public function setXPath($value);
```

## Procedural Interface

```text
ipworkszip_officedoc_get($res, 37 );
ipworkszip_officedoc_set($res, 37, $value );
```

## Default Value

''

## Remarks

XPath implements a subset of the XML XPath specification, allowing you to point to specific elements in the XML document.

The path is a series of one or more element accessors separated by */*. The path can be absolute (starting with */*) or relative to the current XPath location.

 The following are possible values for an element accessor:

|  |  |
| --- | --- |
| 'name' | A particular element name |
| name[i] | The i-th subelement of the current element with the given name |
| [i] | The i-th subelement of the current element |
| [last()] | The last subelement of the current element |
| [last()-i] | The subelement located at the last location minus i in the current element |
| name[@attrname="attrvalue"] | The subelement containing a particular value for a given attribute (supports single AND double quotes) |
| .. | The parent of the current element |

 When XPath is set to a valid path, [XElement](#xelement-property-ipworkszip_officedoc-class) points to the name of the element, with [XParent](#xparent-property-ipworkszip_officedoc-class), [XNamespace](#xnamespace-property-ipworkszip_officedoc-class), [XPrefix](#xprefix-property-ipworkszip_officedoc-class), [XChildName](#xchildname-property-ipworkszip_officedoc-class), [XChildNamespace](#xchildnamespace-property-ipworkszip_officedoc-class), [XChildPrefix](#xchildprefix-property-ipworkszip_officedoc-class), [XChildXText](#xchildxtext-property-ipworkszip_officedoc-class), and [XText](#xtext-property-ipworkszip_officedoc-class) providing other properties of the element. The attributes of the current element are provided in the [AttrName](#attrname-property-ipworkszip_officedoc-class), [AttrNamespace](#attrnamespace-property-ipworkszip_officedoc-class), [AttrPrefix](#attrprefix-property-ipworkszip_officedoc-class), and [AttrValue](#attrvalue-property-ipworkszip_officedoc-class) properties.

BuildDOM must be set to *true* before parsing the document for the XPath functionality to be available.

**Example. Setting XPath:**

|  |  |
| --- | --- |
| Document root | XML.XPath = "/" |
| Specific Element | XML.XPath = "/root/SubElement1/SubElement2/" |
| i-th Child | XML.XPath = "/root/SubElement1[i]" |

## Data Type

String

# XPrefix Property ([IPWorksZip_OfficeDoc](#officedoc-class) Class)

The prefix of the current element.

## Object Oriented Interface

```text
public function getXPrefix();
```

## Procedural Interface

```text
ipworkszip_officedoc_get($res, 38 );
```

## Default Value

''

## Remarks

The current element is specified via the [XPath](#xpath-property-ipworkszip_officedoc-class) property.

This property is read-only.

## Data Type

String

# XSubTree Property ([IPWorksZip_OfficeDoc](#officedoc-class) Class)

This property includes a snapshot of the current element in the document.

## Object Oriented Interface

```text
public function getXSubTree();
```

## Procedural Interface

```text
ipworkszip_officedoc_get($res, 39 );
```

## Default Value

''

## Remarks

The current element is specified through the [XPath](#xpath-property-ipworkszip_officedoc-class) property. For this property to work, you must set [CacheContent](#CacheContent) to *true*.

This property is read-only.

## Data Type

String

# XText Property ([IPWorksZip_OfficeDoc](#officedoc-class) Class)

The text of the current element.

## Object Oriented Interface

```text
public function getXText();
```

## Procedural Interface

```text
ipworkszip_officedoc_get($res, 40 );
```

## Default Value

''

## Remarks

The current element is specified via the [XPath](#xpath-property-ipworkszip_officedoc-class) property.

This property is read-only.

## Data Type

String

# Close Method ([IPWorksZip_OfficeDoc](#officedoc-class) Class)

Closes the Open XML package archive.

## Object Oriented Interface

```text
public function doClose();
```

## Procedural Interface

```text
ipworkszip_officedoc_do_close($res);
```

## Remarks

When this method is called, the class will close the current archive and release all resources.

# Config Method ([IPWorksZip_OfficeDoc](#officedoc-class) Class)

Sets or retrieves a configuration setting.

## Object Oriented Interface

```text
public function doConfig($configurationstring);
```

## Procedural Interface

```text
ipworkszip_officedoc_do_config($res, $configurationstring);
```

## Remarks

Config is a generic method available in every class. It is used to set and retrieve [configuration settings](#config-settings-officedoc-class) for the class.

These settings are similar in functionality to properties, but they are rarely used. In order to avoid "polluting" the property namespace of the class, access to these *internal properties* is provided through the Config method.

To set a configuration setting named *PROPERTY*, you must call *Config("PROPERTY=VALUE")*, where *VALUE* is the value of the setting expressed as a string. For boolean values, use the strings "True", "False", "0", "1", "Yes", or "No" (case does not matter).

To read (query) the value of a [configuration setting](#config-settings-officedoc-class), you must call *Config("PROPERTY")*. The value will be returned as a string.

# ExtractPart Method ([IPWorksZip_OfficeDoc](#officedoc-class) Class)

Reads the contents of the currently selected part.

## Object Oriented Interface

```text
public function doExtractPart();
```

## Procedural Interface

```text
ipworkszip_officedoc_do_extractpart($res);
```

## Remarks

If the part specified by the [PartName](#partname-property-ipworkszip_officedoc-class) property exists, the corresponding physical file will be extracted from the archive and will be available through the [PartData](#partdata-property-ipworkszip_officedoc-class) property.

If the part doesn't exists, or it's stored in interleaved format, an error will be raised.

# FindPartByType Method ([IPWorksZip_OfficeDoc](#officedoc-class) Class)

Looks up a part in the current relationships file by it's type namespace URI.

## Object Oriented Interface

```text
public function doFindPartByType($typeuri);
```

## Procedural Interface

```text
ipworkszip_officedoc_do_findpartbytype($res, $typeuri);
```

## Remarks

If a matching part can be found, it's part name is returned. Otherwise, an empty string is returned.

# GetPropertyValue Method ([IPWorksZip_OfficeDoc](#officedoc-class) Class)

Returns the value of the specified package property.

## Object Oriented Interface

```text
public function doGetPropertyValue($propname, $propnamespace);
```

## Procedural Interface

```text
ipworkszip_officedoc_do_getpropertyvalue($res, $propname, $propnamespace);
```

## Remarks

Looks up a package property named *PropName* in namespace *PropNamespace* in the core and app properties tables and returns it's value, if found.

If the property doesn't exists, an empty string is returned.

For custom properties. use an empty string ("") as the value of the *PropNamespace* parameter.

# ListParts Method ([IPWorksZip_OfficeDoc](#officedoc-class) Class)

List all the parts contained in the document and their relationships.

## Object Oriented Interface

```text
public function doListParts();
```

## Procedural Interface

```text
ipworkszip_officedoc_do_listparts($res);
```

## Remarks

When this method is called, the class will read all the relationships in the document, recursively, and populate the Relationships collection.

# Open Method ([IPWorksZip_OfficeDoc](#officedoc-class) Class)

Opens the Open XML package archive.

## Object Oriented Interface

```text
public function doOpen();
```

## Procedural Interface

```text
ipworkszip_officedoc_do_open($res);
```

## Remarks

When this method is called, the class will attempt to open the archive specified in [PackagePath](#packagepath-property-ipworkszip_officedoc-class) and extract package properties, content types and parse the master relationships file in the archive.

# ParsePart Method ([IPWorksZip_OfficeDoc](#officedoc-class) Class)

Parses the specified part as XML.

## Object Oriented Interface

```text
public function doParsePart();
```

## Procedural Interface

```text
ipworkszip_officedoc_do_parsepart($res);
```

## Remarks

If the part specified by [PartName](#partname-property-ipworkszip_officedoc-class) exists, the corresponding physical file will be extracted from the archive and parsed as XML. If BuildDOM is enabled, the DOM will be built internally and you can use XPath to query the resulting document, using the [XPath](#xpath-property-ipworkszip_officedoc-class) property. If BuildDOM is disabled, only the XML parser-related events will be fired.

# ReadRelationships Method ([IPWorksZip_OfficeDoc](#officedoc-class) Class)

Reads the relationships file in the archive associated with the specified part.

## Object Oriented Interface

```text
public function doReadRelationships();
```

## Procedural Interface

```text
ipworkszip_officedoc_do_readrelationships($res);
```

## Remarks

When this method is called, the class will look for a .rels file associated with the part specified by the [PartName](#partname-property-ipworkszip_officedoc-class) property. If found, the Relationships collection will now expose the contents of the relationships for that part.

# ReplacePart Method ([IPWorksZip_OfficeDoc](#officedoc-class) Class)

Replaces the contents of the specified part in the package.

## Object Oriented Interface

```text
public function doReplacePart();
```

## Procedural Interface

```text
ipworkszip_officedoc_do_replacepart($res);
```

## Remarks

If the part specified by the [PartName](#partname-property-ipworkszip_officedoc-class) property exists, the corresponding physical file will be replaced with the contents of the [PartData](#partdata-property-ipworkszip_officedoc-class) property. The package file will be modified in place right away.

If the part doesn't exists, it's stored in interleaved format, or [PartData](#partdata-property-ipworkszip_officedoc-class) is null or empty, an error will be raised.

# Reset Method ([IPWorksZip_OfficeDoc](#officedoc-class) Class)

Resets the class.

## Object Oriented Interface

```text
public function doReset();
```

## Procedural Interface

```text
ipworkszip_officedoc_do_reset($res);
```

## Remarks

Reset resets the state of the class. All properties will be set to their default values, and any files open will be closed.

# ResolveContentType Method ([IPWorksZip_OfficeDoc](#officedoc-class) Class)

Returns the content type of the specified part.

## Object Oriented Interface

```text
public function doResolveContentType();
```

## Procedural Interface

```text
ipworkszip_officedoc_do_resolvecontenttype($res);
```

## Remarks

Applies the content type resolution rules specified in the Open XML packaging specification and returns the content type associated with [PartName](#partname-property-ipworkszip_officedoc-class) in the archive.

If there's no content type mapped for the part or for the extension, an empty string is returned.

# BeginFile Event ([IPWorksZip_OfficeDoc](#officedoc-class) Class)

Fired before each file is processed.

## Object Oriented Interface

```text
public function fireBeginFile($param);
```

## Procedural Interface

```text
ipworkszip_officedoc_register_callback($res, 1, array($this, 'fireBeginFile'));
```

## Parameter List

```text
 'index' 'skip'
```

## Remarks

BeginFile is fired before each file is processed by the compressor or decompressor, as appropriate. *Index* contains the array index of the file about to be processed, and the [FileCompressedName](#OfficeDoc_p_FileCompressedName), [FileDecompressedName](#OfficeDoc_p_FileDecompressedName), [FileCompressedSize](#OfficeDoc_p_FileCompressedSize) (decompression only), and [FileDecompressedSize](#OfficeDoc_p_FileDecompressedSize) fields of the Files collection for this index contain more detailed information about the file about to be processed.

When extracting, an alternate location may be specified by trapping the event, and modifying [FileDecompressedName](#OfficeDoc_p_FileDecompressedName) and/or ExtractToPath. If [FileDecompressedName](#OfficeDoc_p_FileDecompressedName) is set to an empty string, the file will not be written to disk. If [WriteToProgressEvent](#WriteToProgressEvent) is true, the file will still be decompressed, and the data may be extracted through the [Progress](#progress-event-ipworkszip_officedoc-class) event.

This event may also be trapped while compressing. [FileCompressedName](#OfficeDoc_p_FileCompressedName) and [FileDecompressedName](#OfficeDoc_p_FileDecompressedName) may be changed.

 You may set the *Skip* parameter to true in order to skip the file completely while compressing or extracting.

# Characters Event ([IPWorksZip_OfficeDoc](#officedoc-class) Class)

This event is fired for plaintext segments of the input stream.

## Object Oriented Interface

```text
public function fireCharacters($param);
```

## Procedural Interface

```text
ipworkszip_officedoc_register_callback($res, 2, array($this, 'fireCharacters'));
```

## Parameter List

```text
 'text'
```

## Remarks

The Characters event provides the plaintext content of the XML document (i.e., the text inside the tags). The text is provided through the *Text* parameter.

The text includes whitespace as well as end-of-line characters, except for ignorable whitespace, which is fired through the [IgnorableWhitespace](#ignorablewhitespace-event-ipworkszip_officedoc-class) event.

# Comment Event ([IPWorksZip_OfficeDoc](#officedoc-class) Class)

This event is fired when a comment section is encountered.

## Object Oriented Interface

```text
public function fireComment($param);
```

## Procedural Interface

```text
ipworkszip_officedoc_register_callback($res, 3, array($this, 'fireComment'));
```

## Parameter List

```text
 'text'
```

## Remarks

The Comment event is fired whenever a comment section (*<!-- ...text... -->*) is found in the document.

The full text of the comment is provided by the *Text* parameter.

# EndElement Event ([IPWorksZip_OfficeDoc](#officedoc-class) Class)

This event is fired when an end-element tag is encountered.

## Object Oriented Interface

```text
public function fireEndElement($param);
```

## Procedural Interface

```text
ipworkszip_officedoc_register_callback($res, 4, array($this, 'fireEndElement'));
```

## Parameter List

```text
 'namespace' 'element' 'qname' 'isempty'
```

## Remarks

The EndElement event is fired when an end-element tag is found in the document.

The element name is provided by the *Element* parameter.

The *IsEmpty* parameter is *true* when the event corresponds to an empty element declaration.

# EndFile Event ([IPWorksZip_OfficeDoc](#officedoc-class) Class)

Fired after each file is processed.

## Object Oriented Interface

```text
public function fireEndFile($param);
```

## Procedural Interface

```text
ipworkszip_officedoc_register_callback($res, 5, array($this, 'fireEndFile'));
```

## Parameter List

```text
 'index'
```

## Remarks

EndFile is fired after each file is processed by the compressor or decompressor, as appropriate. *Index* contains the array index of the file processed, and the [FileCompressedName](#OfficeDoc_p_FileCompressedName), [FileDecompressedName](#OfficeDoc_p_FileDecompressedName), [FileCompressedSize](#OfficeDoc_p_FileCompressedSize), and [FileDecompressedSize](#OfficeDoc_p_FileDecompressedSize) fields in the Files collection for this index contain more detailed information about the file processed.

# EndPrefixMapping Event ([IPWorksZip_OfficeDoc](#officedoc-class) Class)

This event is fired when leaving the scope of a namespace declaration.

## Object Oriented Interface

```text
public function fireEndPrefixMapping($param);
```

## Procedural Interface

```text
ipworkszip_officedoc_register_callback($res, 6, array($this, 'fireEndPrefixMapping'));
```

## Parameter List

```text
 'prefix'
```

## Remarks

The [StartPrefixMapping](#startprefixmapping-event-ipworkszip_officedoc-class) event is fired when entering the scope of a namespace declaration.

# Error Event ([IPWorksZip_OfficeDoc](#officedoc-class) Class)

Fired when information is available about errors during data delivery.

## Object Oriented Interface

```text
public function fireError($param);
```

## Procedural Interface

```text
ipworkszip_officedoc_register_callback($res, 7, array($this, 'fireError'));
```

## Parameter List

```text
 'errorcode' 'description'
```

## Remarks

The Error event is fired in case of exceptional conditions during message processing. Normally the class fails with an error.

The *ErrorCode* parameter contains an error code, and the *Description* parameter contains a textual description of the error. For a list of valid error codes and their descriptions, please refer to the [Error Codes](#trappable-errors-officedoc-class) section.

# EvalEntity Event ([IPWorksZip_OfficeDoc](#officedoc-class) Class)

This event is fired every time an entity needs to be evaluated.

## Object Oriented Interface

```text
public function fireEvalEntity($param);
```

## Procedural Interface

```text
ipworkszip_officedoc_register_callback($res, 8, array($this, 'fireEvalEntity'));
```

## Parameter List

```text
 'entity' 'value'
```

## Remarks

The *Value* parameter contains a suggested value for the entity (normally the entity name itself). You may set *Value* to a value of your choice, which will later be passed into the text stream.

# IgnorableWhitespace Event ([IPWorksZip_OfficeDoc](#officedoc-class) Class)

This event is fired when a section of ignorable whitespace is encountered.

## Object Oriented Interface

```text
public function fireIgnorableWhitespace($param);
```

## Procedural Interface

```text
ipworkszip_officedoc_register_callback($res, 9, array($this, 'fireIgnorableWhitespace'));
```

## Parameter List

```text
 'text'
```

## Remarks

The ignorable whitespace section is provided by the *Text* parameter.

# Meta Event ([IPWorksZip_OfficeDoc](#officedoc-class) Class)

This event fires when a meta section is encountered.

## Object Oriented Interface

```text
public function fireMeta($param);
```

## Procedural Interface

```text
ipworkszip_officedoc_register_callback($res, 10, array($this, 'fireMeta'));
```

## Parameter List

```text
 'text'
```

## Remarks

The Meta event is fired whenever a meta information section (*<! ...text... >*) is found in the document.

The full text of the meta section is provided by the *Text* parameter.

# Overwrite Event ([IPWorksZip_OfficeDoc](#officedoc-class) Class)

Fired whenever a file exists and may be overwritten.

## Object Oriented Interface

```text
public function fireOverwrite($param);
```

## Procedural Interface

```text
ipworkszip_officedoc_register_callback($res, 11, array($this, 'fireOverwrite'));
```

## Parameter List

```text
 'filename' 'overwrite'
```

## Remarks

Overwrite is fired when a file is about to be overwritten, and would overwrite an existing file. The event is fired during decompression.

*FileName* contains the full name of the file, specified with its pathname.

*Overwrite* specifies whether or not the file will be overwritten. For Zip, Jar, and Tar, this is equal by default to the value of the OverwriteFiles property. For Gzip, this value defaults to true.

Either of the parameters may be changed when the event is fired. Changing the value of *Overwrite* will override the default behavior of the class, and cause the file to be overwritten or not overwritten, depending on the value set. If *FileName* is changed, the value of *Overwrite* will be ignored, and the file will be written with the specified name. If a file of the new name also exists this file will be silently overwritten.

# PI Event ([IPWorksZip_OfficeDoc](#officedoc-class) Class)

This event is fired when a processing instruction section is encountered.

## Object Oriented Interface

```text
public function firePI($param);
```

## Procedural Interface

```text
ipworkszip_officedoc_register_callback($res, 12, array($this, 'firePI'));
```

## Parameter List

```text
 'text'
```

## Remarks

The PI event is fired whenever a processing instruction section (*<? ...text... ?>*) is found in the document.

The full text of the processing instruction is provided by the *Text* parameter.

# Progress Event ([IPWorksZip_OfficeDoc](#officedoc-class) Class)

Fired as progress is made.

## Object Oriented Interface

```text
public function fireProgress($param);
```

## Procedural Interface

```text
ipworkszip_officedoc_register_callback($res, 13, array($this, 'fireProgress'));
```

## Parameter List

```text
 'data' 'filename' 'bytesprocessed' 'percentprocessed'
```

## Remarks

The Progress event is automatically fired as compression or decompression is performed. When [WriteToProgressEvent](#WriteToProgressEvent) is true, the output data is provided through the *Data* parameter, allowing for it to be streamed out.

*FileName* contains the name of the file being written. If no file is being written, *FileName* will contain an empty string, and the output data will be provided exclusively through this event.

*BytesProcessed* contains the total number of uncompressed bytes processed. *PercentProcessed* contains the percent of uncompressed bytes processed, corresponding roughly to the running time of the operation.

For **Gzip** extraction only, *BytesProcessed* and *PercentProcessed* will reflect the number of compressed bytes extracted, as it is generally impossible to predetermine the total uncompressed size.

If [WriteToProgressEvent](#WriteToProgressEvent) is false, *Data* will contain null.

# SpecialSection Event ([IPWorksZip_OfficeDoc](#officedoc-class) Class)

This event is fired when a special section is encountered.

## Object Oriented Interface

```text
public function fireSpecialSection($param);
```

## Procedural Interface

```text
ipworkszip_officedoc_register_callback($res, 14, array($this, 'fireSpecialSection'));
```

## Parameter List

```text
 'sectionid' 'text'
```

## Remarks

The SpecialSection event is fired whenever a special section (such as *<![ CDATA [ ...text... ]]>*) is found in the document.

The full text of the special section is provided by the *Text* parameter, and the *SectionId* parameter provides the section identifier (e.g., *CDATA*).

# StartElement Event ([IPWorksZip_OfficeDoc](#officedoc-class) Class)

This event is fired when a begin-element tag is encountered in the document.

## Object Oriented Interface

```text
public function fireStartElement($param);
```

## Procedural Interface

```text
ipworkszip_officedoc_register_callback($res, 15, array($this, 'fireStartElement'));
```

## Parameter List

```text
 'namespace' 'element' 'qname' 'isempty'
```

## Remarks

The StartElement event is fired when a begin-element tag is found in the document.

The element name is provided through the *Element* parameter. The attribute names and values (if any) are provided through the [AttrName](#attrname-property-ipworkszip_officedoc-class), [AttrNamespace](#attrnamespace-property-ipworkszip_officedoc-class), [AttrPrefix](#attrprefix-property-ipworkszip_officedoc-class), and [AttrValue](#attrvalue-property-ipworkszip_officedoc-class) properties.

The *IsEmpty* parameter is *true* when the event corresponds to an empty element declaration.

# StartPrefixMapping Event ([IPWorksZip_OfficeDoc](#officedoc-class) Class)

This event is fired when entering the scope of a namespace declaration.

## Object Oriented Interface

```text
public function fireStartPrefixMapping($param);
```

## Procedural Interface

```text
ipworkszip_officedoc_register_callback($res, 16, array($this, 'fireStartPrefixMapping'));
```

## Parameter List

```text
 'prefix' 'uri'
```

## Remarks

The [EndPrefixMapping](#endprefixmapping-event-ipworkszip_officedoc-class) event is fired when leaving the scope of a namespace declaration.

# Config Settings ([OfficeDoc](#officedoc-class) Class)

 The class accepts one or more of the following *configuration settings*. Configuration settings are similar in functionality to properties, but they are rarely used. In order to avoid "polluting" the property namespace of the class, access to these *internal properties* is provided through the [Config](#config-method-ipworkszip_officedoc-class) method.

### OfficeDoc Config Settings

**NormalizePartName**: Whether to normalize Part Names.Sometimes the Part Names retrieved from a document will be of a format that is not directly usable in the [PartName](#partname-property-ipworkszip_officedoc-class) property when retrieving the part. For example:

```text
/ppt/slides/../media/image1.jpeg
```

When this option is set to True the component will automatically normalize these Part Names so that they can be directly used in the [PartName](#partname-property-ipworkszip_officedoc-class) property for retrieving the part. For example, the above would become:

```text
/ppt/media/image1.jpeg
```

The default is True.

**RelationshipIsExternal[x]**: Whether the relationship part is internal or external.Some relationships in an Office document may be external items, such as URLs and files on disk. These relationships are not directly accessible via [ExtractPart](#extractpart-method-ipworkszip_officedoc-class). This configuration option will return "1" if the relationship at index "x" of Relationships is an external part. Otherwise it will return "0"

### Base Config Settings

**BuildInfo**: Information about the product's build.When queried, this setting will return a string containing information about the product's build.

**CodePage**: The system code page used for Unicode to Multibyte translations.The default code page is Unicode UTF-8 (65001).

The following is a list of valid code page identifiers:

|  |  |
| --- | --- |
| Identifier | Name |
| 037 | IBM EBCDIC - U.S./Canada |
| 437 | OEM - United States |
| 500 | IBM EBCDIC - International |
| 708 | Arabic - ASMO 708 |
| 709 | Arabic - ASMO 449+, BCON V4 |
| 710 | Arabic - Transparent Arabic |
| 720 | Arabic - Transparent ASMO |
| 737 | OEM - Greek (formerly 437G) |
| 775 | OEM - Baltic |
| 850 | OEM - Multilingual Latin I |
| 852 | OEM - Latin II |
| 855 | OEM - Cyrillic (primarily Russian) |
| 857 | OEM - Turkish |
| 858 | OEM - Multilingual Latin I + Euro symbol |
| 860 | OEM - Portuguese |
| 861 | OEM - Icelandic |
| 862 | OEM - Hebrew |
| 863 | OEM - Canadian-French |
| 864 | OEM - Arabic |
| 865 | OEM - Nordic |
| 866 | OEM - Russian |
| 869 | OEM - Modern Greek |
| 870 | IBM EBCDIC - Multilingual/ROECE (Latin-2) |
| 874 | ANSI/OEM - Thai (same as 28605, ISO 8859-15) |
| 875 | IBM EBCDIC - Modern Greek |
| 932 | ANSI/OEM - Japanese, Shift-JIS |
| 936 | ANSI/OEM - Simplified Chinese (PRC, Singapore) |
| 949 | ANSI/OEM - Korean (Unified Hangul Code) |
| 950 | ANSI/OEM - Traditional Chinese (Taiwan; Hong Kong SAR, PRC) |
| 1026 | IBM EBCDIC - Turkish (Latin-5) |
| 1047 | IBM EBCDIC - Latin 1/Open System |
| 1140 | IBM EBCDIC - U.S./Canada (037 + Euro symbol) |
| 1141 | IBM EBCDIC - Germany (20273 + Euro symbol) |
| 1142 | IBM EBCDIC - Denmark/Norway (20277 + Euro symbol) |
| 1143 | IBM EBCDIC - Finland/Sweden (20278 + Euro symbol) |
| 1144 | IBM EBCDIC - Italy (20280 + Euro symbol) |
| 1145 | IBM EBCDIC - Latin America/Spain (20284 + Euro symbol) |
| 1146 | IBM EBCDIC - United Kingdom (20285 + Euro symbol) |
| 1147 | IBM EBCDIC - France (20297 + Euro symbol) |
| 1148 | IBM EBCDIC - International (500 + Euro symbol) |
| 1149 | IBM EBCDIC - Icelandic (20871 + Euro symbol) |
| 1200 | Unicode UCS-2 Little-Endian (BMP of ISO 10646) |
| 1201 | Unicode UCS-2 Big-Endian |
| 1250 | ANSI - Central European |
| 1251 | ANSI - Cyrillic |
| 1252 | ANSI - Latin I |
| 1253 | ANSI - Greek |
| 1254 | ANSI - Turkish |
| 1255 | ANSI - Hebrew |
| 1256 | ANSI - Arabic |
| 1257 | ANSI - Baltic |
| 1258 | ANSI/OEM - Vietnamese |
| 1361 | Korean (Johab) |
| 10000 | MAC - Roman |
| 10001 | MAC - Japanese |
| 10002 | MAC - Traditional Chinese (Big5) |
| 10003 | MAC - Korean |
| 10004 | MAC - Arabic |
| 10005 | MAC - Hebrew |
| 10006 | MAC - Greek I |
| 10007 | MAC - Cyrillic |
| 10008 | MAC - Simplified Chinese (GB 2312) |
| 10010 | MAC - Romania |
| 10017 | MAC - Ukraine |
| 10021 | MAC - Thai |
| 10029 | MAC - Latin II |
| 10079 | MAC - Icelandic |
| 10081 | MAC - Turkish |
| 10082 | MAC - Croatia |
| 12000 | Unicode UCS-4 Little-Endian |
| 12001 | Unicode UCS-4 Big-Endian |
| 20000 | CNS - Taiwan |
| 20001 | TCA - Taiwan |
| 20002 | Eten - Taiwan |
| 20003 | IBM5550 - Taiwan |
| 20004 | TeleText - Taiwan |
| 20005 | Wang - Taiwan |
| 20105 | IA5 IRV International Alphabet No. 5 (7-bit) |
| 20106 | IA5 German (7-bit) |
| 20107 | IA5 Swedish (7-bit) |
| 20108 | IA5 Norwegian (7-bit) |
| 20127 | US-ASCII (7-bit) |
| 20261 | T.61 |
| 20269 | ISO 6937 Non-Spacing Accent |
| 20273 | IBM EBCDIC - Germany |
| 20277 | IBM EBCDIC - Denmark/Norway |
| 20278 | IBM EBCDIC - Finland/Sweden |
| 20280 | IBM EBCDIC - Italy |
| 20284 | IBM EBCDIC - Latin America/Spain |
| 20285 | IBM EBCDIC - United Kingdom |
| 20290 | IBM EBCDIC - Japanese Katakana Extended |
| 20297 | IBM EBCDIC - France |
| 20420 | IBM EBCDIC - Arabic |
| 20423 | IBM EBCDIC - Greek |
| 20424 | IBM EBCDIC - Hebrew |
| 20833 | IBM EBCDIC - Korean Extended |
| 20838 | IBM EBCDIC - Thai |
| 20866 | Russian - KOI8-R |
| 20871 | IBM EBCDIC - Icelandic |
| 20880 | IBM EBCDIC - Cyrillic (Russian) |
| 20905 | IBM EBCDIC - Turkish |
| 20924 | IBM EBCDIC - Latin-1/Open System (1047 + Euro symbol) |
| 20932 | JIS X 0208-1990 & 0121-1990 |
| 20936 | Simplified Chinese (GB2312) |
| 21025 | IBM EBCDIC - Cyrillic (Serbian, Bulgarian) |
| 21027 | Extended Alpha Lowercase |
| 21866 | Ukrainian (KOI8-U) |
| 28591 | ISO 8859-1 Latin I |
| 28592 | ISO 8859-2 Central Europe |
| 28593 | ISO 8859-3 Latin 3 |
| 28594 | ISO 8859-4 Baltic |
| 28595 | ISO 8859-5 Cyrillic |
| 28596 | ISO 8859-6 Arabic |
| 28597 | ISO 8859-7 Greek |
| 28598 | ISO 8859-8 Hebrew |
| 28599 | ISO 8859-9 Latin 5 |
| 28605 | ISO 8859-15 Latin 9 |
| 29001 | Europa 3 |
| 38598 | ISO 8859-8 Hebrew |
| 50220 | ISO 2022 Japanese with no halfwidth Katakana |
| 50221 | ISO 2022 Japanese with halfwidth Katakana |
| 50222 | ISO 2022 Japanese JIS X 0201-1989 |
| 50225 | ISO 2022 Korean |
| 50227 | ISO 2022 Simplified Chinese |
| 50229 | ISO 2022 Traditional Chinese |
| 50930 | Japanese (Katakana) Extended |
| 50931 | US/Canada and Japanese |
| 50933 | Korean Extended and Korean |
| 50935 | Simplified Chinese Extended and Simplified Chinese |
| 50936 | Simplified Chinese |
| 50937 | US/Canada and Traditional Chinese |
| 50939 | Japanese (Latin) Extended and Japanese |
| 51932 | EUC - Japanese |
| 51936 | EUC - Simplified Chinese |
| 51949 | EUC - Korean |
| 51950 | EUC - Traditional Chinese |
| 52936 | HZ-GB2312 Simplified Chinese |
| 54936 | Windows XP: GB18030 Simplified Chinese (4 Byte) |
| 57002 | ISCII Devanagari |
| 57003 | ISCII Bengali |
| 57004 | ISCII Tamil |
| 57005 | ISCII Telugu |
| 57006 | ISCII Assamese |
| 57007 | ISCII Oriya |
| 57008 | ISCII Kannada |
| 57009 | ISCII Malayalam |
| 57010 | ISCII Gujarati |
| 57011 | ISCII Punjabi |
| 65000 | Unicode UTF-7 |
| 65001 | Unicode UTF-8 |

 The following is a list of valid code page identifiers for Mac OS only:

|  |  |
| --- | --- |
| Identifier | Name |
| 1 | ASCII |
| 2 | NEXTSTEP |
| 3 | JapaneseEUC |
| 4 | UTF8 |
| 5 | ISOLatin1 |
| 6 | Symbol |
| 7 | NonLossyASCII |
| 8 | ShiftJIS |
| 9 | ISOLatin2 |
| 10 | Unicode |
| 11 | WindowsCP1251 |
| 12 | WindowsCP1252 |
| 13 | WindowsCP1253 |
| 14 | WindowsCP1254 |
| 15 | WindowsCP1250 |
| 21 | ISO2022JP |
| 30 | MacOSRoman |
| 10 | UTF16String |
| 0x90000100 | UTF16BigEndian |
| 0x94000100 | UTF16LittleEndian |
| 0x8c000100 | UTF32String |
| 0x98000100 | UTF32BigEndian |
| 0x9c000100 | UTF32LittleEndian |
| 65536 | Proprietary |

**LicenseInfo**: Information about the current license.When queried, this setting will return a string containing information about the license this instance of a class is using. It will return the following information:

- Product: The product the license is for.
- Product Key: The key the license was generated from.
- License Source: Where the license was found (e.g., RuntimeLicense, License File).
- License Type: The type of license installed (e.g., Royalty Free, Single Server).
- Last Valid Build: The last valid build number for which the license will work.

**MaskSensitiveData**: Whether sensitive data is masked in log messages.In certain circumstances it may be beneficial to mask sensitive data, like passwords, in log messages. Set this to *true* to mask sensitive data. The default is *true*.

**ProcessIdleEvents**: Whether the class uses its internal event loop to process events when the main thread is idle.If set to False, the class will not fire internal idle events. Set this to False to use the class in a background thread on Mac OS. By default, this setting is True.

**SelectWaitMillis**: The length of time in milliseconds the class will wait when DoEvents is called if there are no events to process.If there are no events to process when DoEvents is called, the class will wait for the amount of time specified here before returning. The default value is 20.

**UseInternalSecurityAPI**: Whether or not to use the system security libraries or an internal implementation. When set to *false*, the class will use the system security libraries by default to perform cryptographic functions where applicable.

Setting this configuration setting to *true* tells the class to use the internal implementation instead of using the system security libraries.

 On Windows, this setting is set to *false* by default. On Linux/macOS, this setting is set to *true* by default.

 To use the system security libraries for Linux, OpenSSL support must be enabled. For more information on how to enable OpenSSL, please refer to the [OpenSSL Notes](platforms.md) section.

# Trappable Errors ([OfficeDoc](#officedoc-class) Class)

 **Errors**

The following errors may be generated by the class. Note that frequently the error message will contain more specific information than what is listed here.

Note that some non-fatal errors may be trapped and explicitly ignored in the [Error](#error-event-ipworkszip_officedoc-class) event. This will allow the class to continue operation even in case of error.

### OfficeDoc Errors

|  |  |
| --- | --- |
| 268 | The specified part name could not be found on the package, or the part is stored in interleaved format. |
