Interaction Word and Delphi

0

Good morning, I am putting together a business proposal with delphi where I have defined some fields in a word document that will be replaced by the fields taken from the database. But at the time of passing parameters, it only prints a single item in the document, and I'd like to know how to make it do the same procedure for "n" items that there might be in a proposal. The code snippet that does this transfer is:

  with stpExtracao do
  begin
    first;

    while not eof do
    begin      
       Doc.Content.Find.Execute(FindText:='@ITEM', ReplaceWith             := FieldByName('cd_item_consulta').AsString);
       Doc.Content.Find.Execute(FindText:='@FANTASIA', ReplaceWith         := FieldByName('nm_fantasia_produto').Value);
       Doc.Content.Find.Execute(FindText:='@DESCRICAO_PRODUTO', ReplaceWith:= FieldByName('nm_produto').Value);
       Doc.Content.Find.Execute(FindText:='@CODIGO_CLIENTE', ReplaceWith   := FieldByName('nm_fantasia_prod_cliente').Value);
       Doc.Content.Find.Execute(FindText:='@NCM', ReplaceWith              := FieldByName('ncm').Value);
       Doc.Content.Find.Execute(FindText:='@ITEM', ReplaceWith             := FieldByName('cd_item_consulta').AsString);
    ...
    
asked by anonymous 14.09.2018 / 14:32

0 answers