OfficeDoc Component
Properties Methods Events Configuration Settings Errors
The OfficeDoc component implements support for the Open XML Packaging Format used in Office 2007 documents.
Syntax
Tipz.OfficeDoc
Remarks
The component 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 component with short descriptions. Click on the links for further details.
ContentTypeCount | The number of records in the ContentType arrays. |
ContentTypeIsOverride | Specifies if this is a default content type or an override. |
ContentTypeMediaType | The media type for this entry, as defined by RFC2616. |
ContentTypeTarget | If it's a default content type, this will be the file extension it applies to. |
NamespaceCount | The number of records in the Namespace arrays. |
NamespacePrefix | The Prefix for the Namespace . |
NamespaceURI | Namespace URI associated with the corresponding Prefix . |
PackagePath | The path to the Open XML package file. |
PackagePropertyCount | The number of records in the PackageProperty arrays. |
PackagePropertyDataType | The data type associated with this property, if the information is available. |
PackagePropertyName | The name of this property. |
PackagePropertyNamespace | The XML Namespace URI associated with this property. |
PackagePropertyPropId | If this is a custom property, this will be the pid assigned to it. |
PackagePropertyPropSet | If this is a custom property, this will be the GUID of the property set it belongs to. |
PackagePropertyValue | The value of this property. |
PartData | The contents of the currently selected part. |
PartName | The name of the currently selected part. |
RelationshipCount | The number of records in the Relationship arrays. |
RelationshipContentType | The content type for the part referenced by this relationship, resolved from [Content_Types]. |
RelationshipId | The unique ID of this relationship within this . |
RelationshipPartName | The name of the part this relationship entry applies to. |
RelationshipTypeURI | The XML namespace URI that specifies the meaning of this relationship. |
Validate | When True, the parser checks that the document consists of well-formed XML. |
AttrCount | The number of records in the Attr arrays. |
AttrName | The Name provides the local name (without prefix) of the attribute. |
AttrNamespace | Attribute namespace. |
AttrPrefix | Attribute prefix (if any). |
AttrValue | Attribute value. |
XChildCount | The number of records in the XChild arrays. |
XChildName | The Name property provides the local name (without prefix) of the element. |
XChildNamespace | Namespace of the element. |
XChildPrefix | Prefix of the element (if any). |
XChildXText | The inner text of the element. |
XElement | The name of the current element. |
XNamespace | The namespace of the current element. |
XParent | The parent of the current element. |
XPath | Provides a way to point to a specific element in the document. |
XPrefix | The prefix of the current element. |
XSubTree | A snapshot of the current element in the document. |
XText | The text of the current element. |
Method List
The following is the full list of the methods of the component with short descriptions. Click on the links for further details.
Close | Closes the Open XML package archive. |
Config | Sets or retrieves a configuration setting . |
ExtractPart | Reads the contents of the currently selected part. |
FindPartByType | Looks up a part in the current relationships file by it's type namespace URI. |
GetPropertyValue | Returns the value of the specified package property. |
ListParts | List all the parts contained in the document and their relationships. |
Open | Opens the Open XML package archive. |
ParsePart | Parses the specified part as XML. |
ReadRelationships | Reads the relationships file in the archive associated with the specified part. |
ReplacePart | Replaces the contents of the specified part in the package. |
Reset | Resets the component. |
ResolveContentType | Returns the content type of the specified part. |
Event List
The following is the full list of the events fired by the component with short descriptions. Click on the links for further details.
BeginFile | Fired before each file is processed. |
Characters | Fired for plain text segments of the input stream. |
Comment | Fired when a comment section is encountered. |
EndElement | Fired when an end-element tag is encountered. |
EndFile | Fired after each file is processed. |
EndPrefixMapping | Fired when leaving the scope of a namespace declaration. |
Error | Information about errors during data delivery. |
EvalEntity | Fired every time an entity needs to be evaluated. |
IgnorableWhitespace | Fired when a section of ignorable whitespace is encountered. |
Meta | Fired when a meta section is encountered. |
Overwrite | Fired whenever a file exists and may be overwritten. |
PI | Fired when a processing instruction section is encountered. |
Progress | Fired as progress is made. |
SpecialSection | Fired when a special section is encountered. |
StartElement | Fired when a begin-element tag is encountered in the document. |
StartPrefixMapping | Fired when entering the scope of a namespace declaration. |
Configuration Settings
The following is a list of configuration settings for the component with short descriptions. Click on the links for further details.
NormalizePartName | Whether to normalize Part Names. |
RelationshipIsExternal[x] | Whether the relationship part is internal or external. |
CodePage | The system code page used for Unicode to Multibyte translations. |
ContentTypeCount Property (OfficeDoc Component)
The number of records in the ContentType arrays.
Syntax
property ContentTypeCount: Integer;
Default Value
0
Remarks
This property controls the size of the following arrays: 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 (OfficeDoc Component)
Specifies if this is a default content type or an override.
Syntax
property ContentTypeIsOverride[ContentTypeIndex: Integer]: Boolean;
Default Value
true
Remarks
Specifies if this is a default content type or an override.
The size of the array is controlled by the ContentTypeCount property.
This property is read-only and not available at design time.
Data Type
Boolean
ContentTypeMediaType Property (OfficeDoc Component)
The media type for this entry, as defined by RFC2616.
Syntax
property ContentTypeMediaType[ContentTypeIndex: Integer]: String;
Default Value
''
Remarks
The media type for this entry, as defined by RFC2616.
The size of the array is controlled by the ContentTypeCount property.
This property is read-only and not available at design time.
Data Type
String
ContentTypeTarget Property (OfficeDoc Component)
If it's a default content type, this will be the file extension it applies to.
Syntax
property ContentTypeTarget[ContentTypeIndex: Integer]: String;
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 size of the array is controlled by the ContentTypeCount property.
This property is read-only and not available at design time.
Data Type
String
NamespaceCount Property (OfficeDoc Component)
The number of records in the Namespace arrays.
Syntax
property NamespaceCount: Integer;
Default Value
0
Remarks
This property controls the size of the following arrays: 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 (OfficeDoc Component)
The Prefix for the Namespace .
Syntax
property NamespacePrefix[NamespaceIndex: Integer]: String;
Default Value
''
Remarks
The NamespacePrefix for the Namespace.
The size of the array is controlled by the NamespaceCount property.
This property is read-only and not available at design time.
Data Type
String
NamespaceURI Property (OfficeDoc Component)
Namespace URI associated with the corresponding Prefix .
Syntax
property NamespaceURI[NamespaceIndex: Integer]: String;
Default Value
''
Remarks
Namespace URI associated with the corresponding NamespacePrefix. This is usually a URL pointing to the XML schema for the namespace.
The size of the array is controlled by the NamespaceCount property.
This property is read-only and not available at design time.
Data Type
String
PackagePath Property (OfficeDoc Component)
The path to the Open XML package file.
Syntax
property PackagePath: String;
Default Value
''
Remarks
This property specifies the path and filename of the Open XML package to work on.
Data Type
String
PackagePropertyCount Property (OfficeDoc Component)
The number of records in the PackageProperty arrays.
Syntax
property PackagePropertyCount: Integer;
Default Value
0
Remarks
This property controls the size of the following arrays:- PackagePropertyDataType
- PackagePropertyName
- PackagePropertyNamespace
- PackagePropertyPropId
- PackagePropertyPropSet
- PackagePropertyValue
This property is read-only and not available at design time.
Data Type
Integer
PackagePropertyDataType Property (OfficeDoc Component)
The data type associated with this property, if the information is available.
Syntax
property PackagePropertyDataType[PackagePropertyIndex: Integer]: String;
Default Value
''
Remarks
The data type associated with this property, if the information is available.
The size of the array is controlled by the PackagePropertyCount property.
This property is read-only and not available at design time.
Data Type
String
PackagePropertyName Property (OfficeDoc Component)
The name of this property.
Syntax
property PackagePropertyName[PackagePropertyIndex: Integer]: String;
Default Value
''
Remarks
The name of this property
The size of the array is controlled by the PackagePropertyCount property.
This property is read-only and not available at design time.
Data Type
String
PackagePropertyNamespace Property (OfficeDoc Component)
The XML Namespace URI associated with this property.
Syntax
property PackagePropertyNamespace[PackagePropertyIndex: Integer]: String;
Default Value
''
Remarks
The XML Namespace URI associated with this property. For custom properties, this will be an empty string.
The size of the array is controlled by the PackagePropertyCount property.
This property is read-only and not available at design time.
Data Type
String
PackagePropertyPropId Property (OfficeDoc Component)
If this is a custom property, this will be the pid assigned to it.
Syntax
property PackagePropertyPropId[PackagePropertyIndex: Integer]: String;
Default Value
''
Remarks
If this is a custom property, this will be the pid assigned to it.
The size of the array is controlled by the PackagePropertyCount property.
This property is read-only and not available at design time.
Data Type
String
PackagePropertyPropSet Property (OfficeDoc Component)
If this is a custom property, this will be the GUID of the property set it belongs to.
Syntax
property PackagePropertyPropSet[PackagePropertyIndex: Integer]: String;
Default Value
''
Remarks
If this is a custom property, this will be the GUID of the property set it belongs to.
The size of the array is controlled by the PackagePropertyCount property.
This property is read-only and not available at design time.
Data Type
String
PackagePropertyValue Property (OfficeDoc Component)
The value of this property.
Syntax
property PackagePropertyValue[PackagePropertyIndex: Integer]: String;
Default Value
''
Remarks
The value of this property
The size of the array is controlled by the PackagePropertyCount property.
This property is read-only and not available at design time.
Data Type
String
PartData Property (OfficeDoc Component)
The contents of the currently selected part.
Syntax
property PartData: String;
property PartDataB: RawByteString;
Default Value
''
Remarks
This property will hold the contents of the part selected by PartName after calling the ExtractPart method. It can also be set before calling ReplacePart.
Data Type
Binary String
PartName Property (OfficeDoc Component)
The name of the currently selected part.
Syntax
property PartName: String;
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 (OfficeDoc Component)
The number of records in the Relationship arrays.
Syntax
property RelationshipCount: Integer;
Default Value
0
Remarks
This property controls the size of the following arrays: 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 (OfficeDoc Component)
The content type for the part referenced by this relationship, resolved from [Content_Types].
Syntax
property RelationshipContentType[RelationshipIndex: Integer]: String;
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 size of the array is controlled by the RelationshipCount property.
This property is read-only and not available at design time.
Data Type
String
RelationshipId Property (OfficeDoc Component)
The unique ID of this relationship within this .
Syntax
property RelationshipId[RelationshipIndex: Integer]: String;
Default Value
''
Remarks
The unique ID of this relationship within this .rels file
The size of the array is controlled by the RelationshipCount property.
This property is read-only and not available at design time.
Data Type
String
RelationshipPartName Property (OfficeDoc Component)
The name of the part this relationship entry applies to.
Syntax
property RelationshipPartName[RelationshipIndex: Integer]: String;
Default Value
''
Remarks
The name of the part this relationship entry applies to.
The size of the array is controlled by the RelationshipCount property.
This property is read-only and not available at design time.
Data Type
String
RelationshipTypeURI Property (OfficeDoc Component)
The XML namespace URI that specifies the meaning of this relationship.
Syntax
property RelationshipTypeURI[RelationshipIndex: Integer]: String;
Default Value
''
Remarks
The XML namespace URI that specifies the meaning of this relationship.
The size of the array is controlled by the RelationshipCount property.
This property is read-only and not available at design time.
Data Type
String
Validate Property (OfficeDoc Component)
When True, the parser checks that the document consists of well-formed XML.
Syntax
property Validate: Boolean;
Default Value
true
Remarks
You can set Validate to False when you want to ignore XML format rules (e.g. while parsing HTML files).
Data Type
Boolean
AttrCount Property (OfficeDoc Component)
The number of records in the Attr arrays.
Syntax
property AttrCount: Integer;
Default Value
0
Remarks
This property controls the size of the following arrays: 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 (OfficeDoc Component)
The Name provides the local name (without prefix) of the attribute.
Syntax
property AttrName[AttrIndex: Integer]: String;
Default Value
''
Remarks
The AttrName provides the local name (without prefix) of the attribute.
The size of the array is controlled by the AttrCount property.
This property is read-only and not available at design time.
Data Type
String
AttrNamespace Property (OfficeDoc Component)
Attribute namespace.
Syntax
property AttrNamespace[AttrIndex: Integer]: String;
Default Value
''
Remarks
Attribute namespace.
The size of the array is controlled by the AttrCount property.
This property is read-only and not available at design time.
Data Type
String
AttrPrefix Property (OfficeDoc Component)
Attribute prefix (if any).
Syntax
property AttrPrefix[AttrIndex: Integer]: String;
Default Value
''
Remarks
Attribute prefix (if any). If the attribute does not have a prefix, this property is empty.
The size of the array is controlled by the AttrCount property.
This property is read-only and not available at design time.
Data Type
String
AttrValue Property (OfficeDoc Component)
Attribute value.
Syntax
property AttrValue[AttrIndex: Integer]: String;
Default Value
''
Remarks
Attribute value.
The size of the array is controlled by the AttrCount property.
This property is read-only and not available at design time.
Data Type
String
XChildCount Property (OfficeDoc Component)
The number of records in the XChild arrays.
Syntax
property XChildCount: Integer;
Default Value
0
Remarks
This property controls the size of the following arrays: 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 (OfficeDoc Component)
The Name property provides the local name (without prefix) of the element.
Syntax
property XChildName[XChildIndex: Integer]: String;
Default Value
''
Remarks
The XChildName property provides the local name (without prefix) of the element.
The size of the array is controlled by the XChildCount property.
This property is read-only and not available at design time.
Data Type
String
XChildNamespace Property (OfficeDoc Component)
Namespace of the element.
Syntax
property XChildNamespace[XChildIndex: Integer]: String;
Default Value
''
Remarks
Namespace of the element.
The size of the array is controlled by the XChildCount property.
This property is read-only and not available at design time.
Data Type
String
XChildPrefix Property (OfficeDoc Component)
Prefix of the element (if any).
Syntax
property XChildPrefix[XChildIndex: Integer]: String;
Default Value
''
Remarks
Prefix of the element (if any). If the element does not have a prefix, this property is empty.
The size of the array is controlled by the XChildCount property.
This property is read-only and not available at design time.
Data Type
String
XChildXText Property (OfficeDoc Component)
The inner text of the element.
Syntax
property XChildXText[XChildIndex: Integer]: String;
Default Value
''
Remarks
The inner text of the element.
The size of the array is controlled by the XChildCount property.
This property is read-only and not available at design time.
Data Type
String
XElement Property (OfficeDoc Component)
The name of the current element.
Syntax
property XElement: String;
Default Value
''
Remarks
The current element is specified via the XPath property.
This property is read-only.
Data Type
String
XNamespace Property (OfficeDoc Component)
The namespace of the current element.
Syntax
property XNamespace: String;
Default Value
''
Remarks
The current element is specified via the XPath property.
This property is read-only.
Data Type
String
XParent Property (OfficeDoc Component)
The parent of the current element.
Syntax
property XParent: String;
Default Value
''
Remarks
The current element is specified via the XPath property.
This property is read-only.
Data Type
String
XPath Property (OfficeDoc Component)
Provides a way to point to a specific element in the document.
Syntax
property XPath: String;
Default Value
''
Remarks
XPath implements a subset of the XML XPath specification, allowing you to point to specific elements in the XML documents.
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 |
BuildDOM must be set to True prior to parsing the document for the XPath functionality to be available.
Example (Setting XPath):
Document root XMLpControl.XPath = "/" Specific Element XMLpControl.XPath = "/root/SubElement1/SubElement2/" i-th Child XMLpControl.XPath = "/root/SubElement1[i]"
Data Type
String
XPrefix Property (OfficeDoc Component)
The prefix of the current element.
Syntax
property XPrefix: String;
Default Value
''
Remarks
The current element is specified via the XPath property.
This property is read-only.
Data Type
String
XSubTree Property (OfficeDoc Component)
A snapshot of the current element in the document.
Syntax
property XSubTree: String;
Default Value
''
Remarks
The current element is specified via the XPath property. In order for this property to work you must have the CacheContent set to true.
This property is read-only.
Data Type
String
XText Property (OfficeDoc Component)
The text of the current element.
Syntax
property XText: String;
Default Value
''
Remarks
The current element is specified via the XPath property.
This property is read-only.
Data Type
String
Close Method (OfficeDoc Component)
Closes the Open XML package archive.
Syntax
procedure Close();
Remarks
When this method is called, the component will close the current archive and release all resources.
Config Method (OfficeDoc Component)
Sets or retrieves a configuration setting .
Syntax
function Config(ConfigurationString: String): String;
Remarks
Config is a generic method available in every component. It is used to set and retrieve configuration settings for the component.
These settings are similar in functionality to properties, but they are rarely used. In order to avoid "polluting" the property namespace of the component, 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, you must call Config("PROPERTY"). The value will be returned as a string.
ExtractPart Method (OfficeDoc Component)
Reads the contents of the currently selected part.
Syntax
procedure ExtractPart();
Remarks
If the part specified by the PartName property exists, the corresponding physical file will be extracted from the archive and will be available through the PartData property.
If the part doesn't exists, or it's stored in interleaved format, an error will be raised.
FindPartByType Method (OfficeDoc Component)
Looks up a part in the current relationships file by it's type namespace URI.
Syntax
function FindPartByType(TypeURI: String): String;
Remarks
If a matching part can be found, it's part name is returned. Otherwise, an empty string is returned.
GetPropertyValue Method (OfficeDoc Component)
Returns the value of the specified package property.
Syntax
function GetPropertyValue(PropName: String; PropNamespace: String): String;
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 (OfficeDoc Component)
List all the parts contained in the document and their relationships.
Syntax
procedure ListParts();
Remarks
When this method is called, the component will read all the relationships in the document, recursively, and populate the Relationships collection.
Open Method (OfficeDoc Component)
Opens the Open XML package archive.
Syntax
procedure Open();
Remarks
When this method is called, the component will attempt to open the archive specified in PackagePath and extract package properties, content types and parse the master relationships file in the archive.
ParsePart Method (OfficeDoc Component)
Parses the specified part as XML.
Syntax
procedure ParsePart();
Remarks
If the part specified by PartName 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 property. If BuildDOM is disabled, only the XML parser-related events will be fired.
ReadRelationships Method (OfficeDoc Component)
Reads the relationships file in the archive associated with the specified part.
Syntax
procedure ReadRelationships();
Remarks
When this method is called, the component will look for a .rels file associated with the part specified by the PartName property. If found, the Relationships collection will now expose the contents of the relationships for that part.
ReplacePart Method (OfficeDoc Component)
Replaces the contents of the specified part in the package.
Syntax
procedure ReplacePart();
Remarks
If the part specified by the PartName property exists, the corresponding physical file will be replaced with the contents of the PartData 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 is null or empty, an error will be raised.
Reset Method (OfficeDoc Component)
Resets the component.
Syntax
procedure Reset();
Remarks
Reset resets the state of the component. All properties will be set to their default values, and any files open will be closed.
ResolveContentType Method (OfficeDoc Component)
Returns the content type of the specified part.
Syntax
function ResolveContentType(): String;
Remarks
Applies the content type resolution rules specified in the Open XML packaging specification and returns the content type associated with PartName in the archive.
If there's no content type mapped for the part or for the extension, an empty string is returned.
BeginFile Event (OfficeDoc Component)
Fired before each file is processed.
Syntax
type TBeginFileEvent = procedure BeginFile(Sender: TObject; Index: Integer;var Skip: Boolean) of object;
property OnBeginFile: TBeginFileEvent read FOnBeginFile write FOnBeginFile;
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, FileDecompressedName, FileCompressedSize (decompression only), and 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 and/or ExtractToPath. If the appropriate value of FileDecompressedName is set to an empty string, the file will not be written to disk. If WriteToProgressEvent is true, the file will still be decompressed, and the data may be extracted through the Progress event.
This event may also be trapped while compressing. FileCompressedName and 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 (OfficeDoc Component)
Fired for plain text segments of the input stream.
Syntax
type TCharactersEvent = procedure Characters(Sender: TObject; const Text: String) of object;
property OnCharacters: TCharactersEvent read FOnCharacters write FOnCharacters;
Remarks
The Characters event provides the plain text content of the XML document (i.e. the text inside the tags). The text is provided through the Text parameter.
The text includes white space as well as end of line characters, except for ignorable whitespace which is fired through the IgnorableWhitespace event.
Comment Event (OfficeDoc Component)
Fired when a comment section is encountered.
Syntax
type TCommentEvent = procedure Comment(Sender: TObject; const Text: String) of object;
property OnComment: TCommentEvent read FOnComment write FOnComment;
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 (OfficeDoc Component)
Fired when an end-element tag is encountered.
Syntax
type TEndElementEvent = procedure EndElement(Sender: TObject; const Namespace: String; const Element: String; const QName: String; IsEmpty: Boolean) of object;
property OnEndElement: TEndElementEvent read FOnEndElement write FOnEndElement;
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 with an empty element declaration.
EndFile Event (OfficeDoc Component)
Fired after each file is processed.
Syntax
type TEndFileEvent = procedure EndFile(Sender: TObject; Index: Integer) of object;
property OnEndFile: TEndFileEvent read FOnEndFile write FOnEndFile;
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, FileDecompressedName, FileCompressedSize, and FileDecompressedSize fields in the Files collection for this index contain more detailed information about the file processed.
EndPrefixMapping Event (OfficeDoc Component)
Fired when leaving the scope of a namespace declaration.
Syntax
type TEndPrefixMappingEvent = procedure EndPrefixMapping(Sender: TObject; const Prefix: String) of object;
property OnEndPrefixMapping: TEndPrefixMappingEvent read FOnEndPrefixMapping write FOnEndPrefixMapping;
Remarks
The StartPrefixMapping event is fired when entering the scope of a namespace declaration.
Error Event (OfficeDoc Component)
Information about errors during data delivery.
Syntax
type TErrorEvent = procedure Error(Sender: TObject; ErrorCode: Integer; const Description: String) of object;
property OnError: TErrorEvent read FOnError write FOnError;
Remarks
The Error event is fired in case of exceptional conditions during message processing. Normally the component raises an exception.
ErrorCode contains an error code and Description contains a textual description of the error. For a list of valid error codes and their descriptions, please refer to the Error Messages section.
EvalEntity Event (OfficeDoc Component)
Fired every time an entity needs to be evaluated.
Syntax
type TEvalEntityEvent = procedure EvalEntity(Sender: TObject; const Entity: String;var Value: String) of object;
property OnEvalEntity: TEvalEntityEvent read FOnEvalEntity write FOnEvalEntity;
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 be later passed into the text stream.
IgnorableWhitespace Event (OfficeDoc Component)
Fired when a section of ignorable whitespace is encountered.
Syntax
type TIgnorableWhitespaceEvent = procedure IgnorableWhitespace(Sender: TObject; const Text: String) of object;
property OnIgnorableWhitespace: TIgnorableWhitespaceEvent read FOnIgnorableWhitespace write FOnIgnorableWhitespace;
Remarks
The ignorable whitespace section is provided by the Text parameter.
Meta Event (OfficeDoc Component)
Fired when a meta section is encountered.
Syntax
type TMetaEvent = procedure Meta(Sender: TObject; const Text: String) of object;
property OnMeta: TMetaEvent read FOnMeta write FOnMeta;
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 (OfficeDoc Component)
Fired whenever a file exists and may be overwritten.
Syntax
type TOverwriteEvent = procedure Overwrite(Sender: TObject;var Filename: String;var Overwrite: Boolean) of object;
property OnOverwrite: TOverwriteEvent read FOnOverwrite write FOnOverwrite;
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 component, 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 (OfficeDoc Component)
Fired when a processing instruction section is encountered.
Syntax
type TPIEvent = procedure PI(Sender: TObject; const Text: String) of object;
property OnPI: TPIEvent read FOnPI write FOnPI;
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 (OfficeDoc Component)
Fired as progress is made.
Syntax
type TProgressEvent = procedure Progress(Sender: TObject; Data: String; const Filename: String; BytesProcessed: Int64; PercentProcessed: Integer) of object;
property OnProgress: TProgressEvent read FOnProgress write FOnProgress;
Remarks
The Progress event is automatically fired as compression or decompression is performed. When 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 is false, Data will contain null.
SpecialSection Event (OfficeDoc Component)
Fired when a special section is encountered.
Syntax
type TSpecialSectionEvent = procedure SpecialSection(Sender: TObject; const SectionId: String; const Text: String) of object;
property OnSpecialSection: TSpecialSectionEvent read FOnSpecialSection write FOnSpecialSection;
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, while the SectionId parameter provides the section identifier (e.g. "CDATA").
StartElement Event (OfficeDoc Component)
Fired when a begin-element tag is encountered in the document.
Syntax
type TStartElementEvent = procedure StartElement(Sender: TObject; const Namespace: String; const Element: String; const QName: String; IsEmpty: Boolean) of object;
property OnStartElement: TStartElementEvent read FOnStartElement write FOnStartElement;
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 XAttributes properties.
The IsEmpty parameter is true when the event corresponds with an empty element declaration.
StartPrefixMapping Event (OfficeDoc Component)
Fired when entering the scope of a namespace declaration.
Syntax
type TStartPrefixMappingEvent = procedure StartPrefixMapping(Sender: TObject; const Prefix: String; const URI: String) of object;
property OnStartPrefixMapping: TStartPrefixMappingEvent read FOnStartPrefixMapping write FOnStartPrefixMapping;
Remarks
The EndPrefixMapping event is fired when leaving the scope of a namespace declaration.
Configuration Settings (OfficeDoc Component)
The component 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 component, access to these internal properties is provided through the Config method.OfficeDoc Configuration 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
property when retrieving the part. For example:
/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 property
for retrieving the part. For example, the above would become:
/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. This configuration option will return "1" if the relationship at index "x" of the Relationship* arrays is an external part. Otherwise it will return "0" |
Base Configuration Settings
CodePage: The system code page used for Unicode to Multibyte translations.
The default code page is the Active Code Page (0).
The following is a list of valid code page identifiers:
|
Trappable Errors (OfficeDoc Component)
ErrorsThe following errors may be generated by the component. 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 event. This will allow the component 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. |