# 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

1. Open the source file by calling the `ExtractOpenDocument` method. This call defines the parameters necessary to open a file for extraction.
2. Determine whether the main file is a container file (contains subfiles) by calling the `ExtractGetMainFileInfo()` method.
3. If the call to `ExtractGetMainFileInfo()` determined the source file is a container file, proceed to step 4; otherwise, filter the file.
4. Determine whether the subfile is itself a container (contains subfiles) by calling the `ExtractGetSubFileInfo` method.
5. Extract the subfile by calling the `ExtractSubFile` method.
6. 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.

_FT_HTML5_bannerTitle.htm