Create a Root Node
Some container files do not contain a subfile or folder which acts as a root directory on which the hierarchy can be based. For example, subfiles in a Zip archive can be extracted, but none of the subfiles represent the root of the hierarchy. In this case, an artificial root node must be created at the top of the file hierarchy as a point of reference for each child, and ultimately to recreate the relationships. This artificial root node is an internal object, and is extracted to disk as a directory called root
. Its index number is 0.
To create a root node, set the CreateRootNode
property of the ExtractOpenDocConfig
object that you pass to the ExtractOpenDocumentEx
method. When a root node is created, the value of the NumSubFiles
property of the ExtractMainFileInfo
object returned by the ExtractGetMainFileInfo
method includes the root node. For example, when you call ExtractGetMainFileInfo
on a Microsoft Word document with three embedded OLE objects and the root node is disabled, the number of subfiles is 3. If you create a root node, the number of subfiles is 4.