KVExtractSubFileArg
This structure defines the input parameters required to extract a subfile. See fpExtractSubFile(). The structure is defined in kvxtract.h.
typedef struct tag_KVExtractSubFileArg
{
KVStructHeader;
int index;
KVCharSet srcCharset;
KVCharSet trgCharset;
int isMSBLSB;
DWORD extractionFlag
char *filePath;
char *extractDir;
KVOutputStream *stream;
}
KVExtractSubFileArgRec, *KVExtractSubFileArg;
Member Descriptions
KVStructHeader
|
The KeyView version of the structure. See KVStructHead. |
index
|
The index number of the subfile to be extracted. |
srcCharset
|
Specifies the source character set of the subfile when the file format’s reader cannot determine the character set. The character sets are enumerated in KVCharSet in kvcharset.h. See Discussion. |
trgCharset
|
If the file type is KVFileType_Main, this is the target character set of the extracted file. Otherwise, this is ignored. The character sets are enumerated in KVCharSet in kvcharset.h. See Discussion. |
isMSBLSB
|
This flag indicates whether the byte order for Unicode text is Big Endian (MSBLSB) or Little Endian (LSBMSB). |
extractionFlag
|
A bitwise flag that defines additional parameters for file extraction. The following flags are available:
|
filePath
|
A pointer to the suggested path or file name to which the subfile is extracted. This can be a file name, partial path, or full path. You can use this in conjunction with extractDir to create the full output path. See Discussion. |
extractDir
|
A pointer to the directory to which subfiles are extracted. This directory must exist. If you set this flag, the path specified in KVOpenFileArg->extractDir is ignored. You can use this in conjunction with filePath to create the full output path. |
stream
|
A pointer to an output stream defined by KVOutputStream. See Discussion. |
Discussion
-
If the document character set is detected and is also specified in
srcCharset, the detected character set is overridden by the specified character set. If the source character set is not detected and is not specified, character set conversion does not occur. -
The
KVSubFileExtractInfoFlag_CharsetConvertedflag in the KVSubFileExtractInfo structure indicates whether the character set of the subfile was converted during extraction. -
The following applies when the output is to a file:
-
If
filePathis a valid absolute path, the file is extracted to the specified path andextractDiris ignored. However, if you have set the flagKVExtractionFlag_SanitizeAbsolutePathsthe output path is modified to ensure it is within theextractDir. For more information, see Sanitize Absolute Paths. -
If
filePathis a file name or partial path, the target directory specified in eitherKVExtractSubFileArg->extractDirorKVOpenFileArg->extractDiris used to create the full path. See KVOpenFileArg. -
If
filePathis a full path or partial path, andcreateDirisTRUE, the directory is created if it does not already exist. -
If
filePathis not specified, a default name and the target directory specified in eitherKVExtractSubFileArg->extractDirorKVOpenFileArg->extractDirare used to create a full path. -
If both
filePathandextractDirare not specified or are invalid, an error is returned. -
If
filePathis valid, butextractDiris not valid, an error is returned.
-
-
The following applies when the output is to a stream:
-
Set
filePathandextractDirtoNULL. -
The file format (
docInfo) and extraction file path (filePath) are not returned in KVSubFileExtractInfo. -
The
KVExtractionFlag_CreateDirandKVExtractionFlag_Overwriteflags are ignored.
-
-
On Windows,
filePathandextractDirmust be in the local Windows code page.