Below is an example of a call to GetSummaryInfo():
If the get summary flag -i is set:
List<SummaryInfoElement> sinfo sinfo = objFilter.GetSummaryInfo();
if(sinfo != null)
{
FileStream fs = new FileStream(m_summaryFile, FileMode.OpenOrCreate, FileAccess.Write);
StreamWriter sw = new StreamWriter(fs);
//In case the ANSI is not 1252, using following to get byte array and then convert to correct information.
// BinaryWriter bw = new BinaryWriter(fs);
string charSet = objFilter.TargetCharSet;
foreach (SummaryInfoElement item in sinfo)
{
Console.WriteLine( item.ElementName + ". data: " + item.Data );
if (item.ElementName != null)
{
//bw.Write(item.ElementNameByteArray);
sw.WriteLine(" name: " + item.ElementName );
}
if (item.Data != null)
{
//bw.Write(item.DataByteArray);
sw.WriteLine(" data: " + item.Data );
}
sw.Flush();
}
sw.Close();
fs.Close();
}
sinfo=null;
The SummaryInfo class stores the metadata extraction results. After calling the Filter.GetSummaryInfo()method, call the properties provided by each instance of this class to extract metadata. The following describes each property:
Isvalid. Specifies whether the element data is present. SumInfoType. Sets or gets the summary element's data type. The possible types are:
Data. Sets or gets the summary element's content.
If type is KV_Int4 or KV_Bool, then data contains the actual value. Otherwise, Data is a pointer to the actual value.
KV_IEEE8 point to an 8-byte value.
KV_DateTime , KV_String and KV_Unicode point to the beginning of the string that contains the text. KV_Unicode is replaced with KV_String when the UNICODE value has been character mapped to the desired output character set.
ElementName. Sets or gets the summary element's name.ElementNameByteArray. Sets or gets the summary element's name using a byte array in case the character set is not known.DataByteArray. Gets the summary element’s content using a byte array.
If the SumInfoType is KV_DateTime , the value in the DataByteArray is a 64-bit value representing the number of 100-nanosecond intervals since January 1, 1601 (Windows FILETIME EPOCH). You might need to convert this value into another format.
|
|