procedure TForm1.InsertWordPictureAfter(strSourceWord: string);
var
Word: OleVariant;
begin
Word := CreateOleObject('Word.Application');
try
Word.Documents.Open(strSourceWord, False);
Word.Visible := False;
Word.ActiveDocument.Range(0, 0);
Word.ActiveDocument.Range.InsertParagraphAfter;
Word.Selection.InlineShapes.addpicture(extractfilepath(Application.ExeName)+'\test.jpg',False, True);
//Word.ActiveDocument.Range.InlineShapes.addpicture(extractfilepath(Application.ExeName)+'\test.jpg',True, True); //Word.saved := True;
Word.Documents.close;
finally
Word.Quit;
Word := Unassigned;
end;
end;
这种只能放在开头
var
Word: OleVariant;
begin
Word := CreateOleObject('Word.Application');
try
Word.Documents.Open(strSourceWord, False);
Word.Visible := False;
Word.ActiveDocument.Range(0, 0);
Word.ActiveDocument.Range.InsertParagraphAfter;
Word.Selection.InlineShapes.addpicture(extractfilepath(Application.ExeName)+'\test.jpg',False, True);
//Word.ActiveDocument.Range.InlineShapes.addpicture(extractfilepath(Application.ExeName)+'\test.jpg',True, True); //Word.saved := True;
Word.Documents.close;
finally
Word.Quit;
Word := Unassigned;
end;
end;
这种只能放在开头
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货