BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How to insert image in word (OleContainer)

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi OLE Automation
View previous topic :: View next topic  
Author Message
Omar Mahanna
Guest





PostPosted: Sun Jun 19, 2005 6:13 am    Post subject: How to insert image in word (OleContainer) Reply with quote



Iam Use Delphi 7.0 , use OleContainer to open in my form.

Back to top
jacques oberto
Guest





PostPosted: Mon Jun 20, 2005 8:30 am    Post subject: Re: How to insert image in word (OleContainer) Reply with quote




"Omar Mahanna" a écrit
Quote:
Iam Use Delphi 7.0 , use OleContainer to open in my form.



The simplest way is to use the clipboard:

var
Word: olevariant;
[...]
Word := CreateOleObject('Word.Application');
Word.Visible := True;
Word.Documents.Add;
[...]
Clipboard.Assign(BMP);
Word.Selection.Paste;
[...]


Jacques



Back to top
Marin Atanasov
Guest





PostPosted: Thu Jun 30, 2005 10:29 am    Post subject: Re: How to insert image in word (OleContainer) Reply with quote



Quote:
var
Word: olevariant;
[...]
Word := CreateOleObject('Word.Application');
Word.Visible := True;
Word.Documents.Add;
[...]
Clipboard.Assign(BMP);
Word.Selection.Paste;
[...]

I don't think it is good idea. Documentations say that you can't use

clipboard without "user permission" i.e. you can put something in the
Clipboard only when user asks (Selects Copy, Cut commands).
I think that better approach is:
----------
procedure TForm1.Button1Click(Sender: TObject);
Var
Word : OleVariant;
Doc : OleVariant;
shape : InlineShape;
begin
Word := CreateOleObject('Word.Application');
Word.Visible := True;
Doc := Word.Documents.Add;

shape := Word.Selection.InlineShapes.AddPicture(FileName := 'C:Documents
and SettingsMarinMy DocumentsMy PicturesMacki9.jpg',
LinkToFile:=False, SaveWithDocument:=True);
end;
----------------
You can also try use:
Word.Selection.InlineShapes' methods like
AddOLEObject(), AddOLEControl()




Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi OLE Automation All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.