Close
dtSearch Text Retrieval Engine Programmer's Reference
IFileConverter Interface

Converts files to HTML, RTF, or text, optionally highlighting hits in the output.

File: dten600.idl 

Module: COM Interface 

Syntax
IDL
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
IFileConverter