Extract Subfiles
To filter all files in a container file, you must open the container and extract its subfiles to either a file or a stream by using the File Extraction API. The extraction process is done repeatedly until all subfiles are extracted and exposed for filtering. After a subfile is extracted, you can call Filter API methods to filter the data.
If you want to filter a container file and its subfiles, to a single file, you must extract all files from the container, filter the files, and then append each filtered output file to its parent.
To extract subfiles
- Open the source file by calling the
ExtractOpenDocumentEx
method. This call defines the parameters necessary to open a file for extraction. - Determine whether the main file is a container file (contains subfiles) by calling the
ExtractGetMainFileInfo()
method. - If the call to
ExtractGetMainFileInfo()
determined the source file is a container file, proceed to step 4; otherwise, filter the file. - Determine whether the subfile is itself a container (contains subfiles) by calling the
ExtractGetSubFileInfo
method. - Extract the subfile by calling the
ExtractSubFile
method. - If the call to
ExtractGetSubFileInfo
determined the subfile is a container file, repeat step 1 through step 5 until all subfiles are extracted and the lowest level of subfiles is reached; otherwise, filter the file.