Create a Root Node

Because of their structure, 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 in the ExtractOpenDocConfig contructor, and pass ExtractOpenDocConfig to the ExtractOpenDocument method. When a root node is created, the value returned from the NumSubFiles property in the ExtractMainFileInfo constructor 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.