texttemplateconverter ConvertToFile method
Return to Introduction  Previous page  Next page
Applies to
acTextTemplateConverter component.  

Declaration
function ConvertToFile(const Template, FileName: String): Boolean;  

Description
The ConvertToFile converts the text Template (translates all keywords specified in Params property) and saves the converted template to the file specified FileName parameter.  

Example
procedure TForm1.Button1Click(Sender: TObject);  
var  
  I: Integer;  
begin  
  if acStringListContainer1.Count <> 0 then  
   for I := 0 to acStringListContainer1.Count - 1 do  
    begin  
     acTemplateConverter1.ParamByName('%product_name%').Value := acStringListContainer1.Values[I];  
     acTemplateConverter1.ParamByName('%product_id%').Value := acStringListContainer1.Names[I];  
     acTemplateConverter1.ConvertToFile(TemplateMemo.Lines.Text,  
                                        'output\' + acStringListContainer1.Names[I] + '.html');  
    end;  
end;  

See also
Params property;  
Convert, ConvertStrings and ConvertStream methods.