Converts files to HTML, RTF, or text, optionally highlighting hits in the output.
[ object, uuid(697DF026-B24E-11D3-B57C-00105AA461D0), dual, helpstring("IFileConverter Interface"), pointer_default(unique) ]
interface IFileConverter : IDispatch;The FileConverter object converts files to HTML (or RTF or plain text), optionally marking hits with caller-supplied HTML tags. To convert a file to HTML, create a FileConverter, use the properties below to describe the conversion task you want to perform, and call the Execute() method.
Use the NewFileConverter method of the Server object to create a new FileConverter object.
When highlighting hits from search results, use SetInputItem to initialize the FileConverter with information obtained from SearchResults.
BeforeHit, AfterHit, Header, and Footer control the appearance of converted text. Header and Footer are inserted before and after the body of the document. The BeforeHit and AfterHit markers are inserted before and after each hit word. The BeforeHit and AfterHit markers can contain hypertext links. To facilitate creation of hit navigation markers, the strings "%%ThisHit%%", "%%NextHit%%", and "%%PrevHit%%" will be replaced with ordinals representing the current hit, the next hit, and the previous hit in the document. The example code below uses the BeforeHit and NextHit marks as HTML "Previous Hit" and "Next Hit" buttons.
This example converts a file to HTML, adding tags around each hit to facilitate navigation of the document (the tags are hypertext links to the previous/next hit in the document). Results is a SearchResults object with the results of a search.
Dim cj As Object Set cj = TheEngine.NewFileConverter ' Set up the FileConverter to convert an item from a SearchResults ' object, Results cj.SetInputItem(Results, whichDocumentToDisplay) Dim quote As String quote = Chr$(34) ' ' Surround each hit with angle brackets (<< and >>) and make each ' angle bracket a link to the next/prev hit ' cj.BeforeHit = "<A NAME=" + quote + "hit%%ThisHit%%" + quote + "></A>" + _ "<A HREF=" + quote + "#hit%%PrevHit%%" + quote + ">" + _ "<<</A><b>" cj.AfterHit = "</b><A HREF=" + quote + "#hit%%NextHit%%" + quote + ">" + _ ">></A>" cj.Header = "<HR><A HREF=" + quote + "#hit1" + quote + ">Click here for first hit</A><BR><HR>" cj.Footer = "<HR>Converted by the dtSearch Engine" cj.OutputFile = tempName cj.Execute
|
Method |
Description |
|
Performs the conversion | |
|
Set up the FileConverter to highlight hits in an item retrieved from SearchResults. |
|
Property |
Description |
|
Text to insert after each hit | |
|
The location of the dtSearch alphabet file to use when highlighting hits. | |
|
For HTML output, an HREF for a BASE tag to be inserted in the header. | |
|
Text to insert before each hit | |
|
File format of the input document, as detected by the dtSearch Engine. | |
|
A JobErrorInfo (IJobErrorInfo) containing information about any errors that occurred during conversion. | |
|
ConvertFlags specifying how the conversion is to be done | |
|
Text to insert at the end of each file | |
|
Text to insert at the start of the file | |
|
A string containing word offsets of the hits to be marked in the document, separated by spaces. | |
|
For HTML output, tags to insert after the HEAD tag. | |
|
The index this item was found in. | |
|
The document ID of this document in the index it was found in. | |
|
If the document was indexed using IndexJob.DataSourceToIndex, supply the same fields in InputFields that the DataSourceToIndex object returned for this document in the DocFields property. | |
|
Name of the file to convert | |
|
If the document was indexed using IndexJob.DataSourceToIndex, supply the same text in InputText that the DataSourceToIndex object returned for this document in the DocText property. | |
|
Type id of the file parser to use to convert this file. | |
|
Name of the converted file to create | |
|
Output format for the conversion (see OutputFormats enum for a list of types). | |
|
If OutputToString is true, output will be stored in OutputString rather than in a disk file. | |
|
When output is directed to an in-memory string, you may wish to limit the maximum amount of memory used. | |
|
If true, output will be stored in an in-memory string variable rather than a disk file. | |
|
Set TimeoutSeconds to the maximum amount of time you want to permit. |
|
Property |
|
read only |
|
Method |
|
Copyright (c) 1995-2012 dtSearch Corp. All rights reserved.
|