2004. május 1., szombat

Insert text at bookmark positions of a Word document


Problem/Question/Abstract:

How to insert text at bookmark positions of a Word document

Answer:

procedure WordBookInsert(v: OleVariant; sgoto, sdata: string);
begin
  try
    {make sure we have passed a word.application level variant}
    if not varisempty(v) then
    begin
      V.Selection.goto(What := wdGoToBookmark, Name := sgoto);
      V.Selection.TypeText(Text := SDATA);
    end;
  except
    {trap OLE errors and display message if it fails}
    on E: sysutils.exception do
    begin
      showmessage(e.message);
    end;
  end;
end;

Nincsenek megjegyzések:

Megjegyzés küldése