texttemplateconverter ConvertStream method
Return to Introduction  Previous page  Next page
Applies to
TextTemplateConverter component.  

Declaration
procedure ConvertStream(Stream: TStream);  

Description
The ConvertStream method is the same as Convert, but translates the text in the streams or their descendants (MemoryStream's, FileStream's etc).  
 
It checks the template string specified in Value parameter, found in that string all the %keywords% specified in Name property of Params collection, replaces the %keywords% with the text specified in Value property of Params.  
 
After calling the ConvertStream method, the Stream will contain translated text, where all keywords replaced with their actual values.  

Example
procedure TForm1.Button1Click(Sender: TObject);  
var  
  fs: TFileStream;  
begin  
  fs := TFileStream.Create('c:\file.txt', fmOpenReadWrite);  
  try  
    TextTemplateConverter1.ConvertStream(fs);  
  finally  
    fs.Free;  
  end;    
end;  

See also
Params property;  
Convert and ConvertStrings methods.