Insert text at bookmark positions of a Word document (Views: 28)
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; |