Converts files to HTML, RTF, or text, optionally highlighting hits in the output.
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.