🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.delphi.vcl.components.using.dotnet
5 messages
5 total messages Started by Venkatesh VT Wed, 14 Dec 2005 16:41
How to use Server (Word,Excel components) components in VCl.net
#194
Author: Venkatesh VT
Date: Wed, 14 Dec 2005 16:41
3 lines
1173 bytes
How can i use the Server components(Word,Excel etc) in a Vcl.Net
application.I know presently they are only available for Win 32 applications
Venkatesh
Re: How to use Server (Word,Excel components) components in VCl.net
#195
Author: Marc Rohloff TeamB
Date: Thu, 15 Dec 2005 03:18
22 lines
2074 bytes
On Wed, 14 Dec 2005 22:11:14 +0530, Venkatesh VT wrote:

> How can i use the Server components(Word,Excel etc) in a Vcl.Net
> application.I know presently they are only available for Win 32 applications
> Venkatesh

Are you trying to embed Word into your application or just control
them programmatically?

For the latter just bring up the 'add reference' dialog and go to the
'COM Imports' tab and add the libraries you need (you may need more
than one)
Once you have done this you can create and access objects in the type
library just as if they were any other .NET object.  (You would
normally have to include something like 'uses Interop.Word'.

If you right click on the added reference and choose 'open' you will
get the assembly browser which is quite useful.

-- 
Marc Rohloff [TeamB]
marc rohloff -at- myrealbox -dot- com
Re: How to use Server (Word,Excel components) components in VCl.net
#196
Author: VT Venkatesh
Date: Thu, 15 Dec 2005 03:40
22 lines
1912 bytes
Marc Rohloff [TeamB] wrote:

> 
> Are you trying to embed Word into your application or just control
> them programmatically?
> 
> For the latter just bring up the 'add reference' dialog and go to the
> 'COM Imports' tab and add the libraries you need (you may need more
> than one)
> Once you have done this you can create and access objects in the type
> library just as if they were any other .NET object.  (You would
> normally have to include something like 'uses Interop.Word'.
> 
> If you right click on the added reference and choose 'open' you will
> get the assembly browser which is quite useful.
> 

Thanks for the information.How ever  is it possible to create server 
components in vcl.net.In Delphi 2005 there are no such components for 
vcl.net where as they exist for VCL win 32.
Do you know the reason why these server components were left out of vcl.net
Venkatesh
Re: How to use Server (Word,Excel components) components in VCl.net
#197
Author: VT Venkatesh
Date: Thu, 15 Dec 2005 05:18
41 lines
2541 bytes
Marc Rohloff [TeamB] wrote:

> Are you trying to embed Word into your application or just control
> them programmatically?
> 
> For the latter just bring up the 'add reference' dialog and go to the
> 'COM Imports' tab and add the libraries you need (you may need more
> than one)
> Once you have done this you can create and access objects in the type
> library just as if they were any other .NET object.  (You would
> normally have to include something like 'uses Interop.Word'.
> 
> If you right click on the added reference and choose 'open' you will
> get the assembly browser which is quite useful.
> 

I tried the following code for automating outlook in a VCL.Net 
application(after adding the reference of Outlook & adding Outlook to 
the uses class)
****************************************************

procedure TForm2.Button1Click(Sender: TObject);
var

   Outlook, NmSpace, Folder: olevariant;


begin
   Outlook1 := CreateOleObject('Outlook.Application');
   NmSpace := Outlook.GetNamespace('MAPI');
   NmSpace.Logon(EmptyParam, EmptyParam, False, True);
   Folder := NmSpace.GetDefaultFolder(olFolderInbox);
   Folder.Display;
end.
*********************************************************

I got the error
"[Pascal Error] Unit2.pas(33): E2003 Undeclared identifier: 
'CreateOleObject'"
Where cani find some documentation to correctly create the Outlook objects
Venkatesh
Re: How to use Server (Word,Excel components) components in VCl.net
#198
Author: Marc Rohloff TeamB
Date: Fri, 16 Dec 2005 00:47
43 lines
2527 bytes
On Thu, 15 Dec 2005 10:48:26 +0530, VT Venkatesh wrote:

> Marc Rohloff [TeamB] wrote:
> I tried the following code for automating outlook in a VCL.Net 
> application(after adding the reference of Outlook & adding Outlook to 
> the uses class)
> ****************************************************
> 
> procedure TForm2.Button1Click(Sender: TObject);
> var
> 
>    Outlook, NmSpace, Folder: olevariant;
> 
> begin
>    Outlook1 := CreateOleObject('Outlook.Application');
>    NmSpace := Outlook.GetNamespace('MAPI');
>    NmSpace.Logon(EmptyParam, EmptyParam, False, True);
>    Folder := NmSpace.GetDefaultFolder(olFolderInbox);
>    Folder.Display;
> end.
> *********************************************************
> 
> I got the error
> "[Pascal Error] Unit2.pas(33): E2003 Undeclared identifier: 
> 'CreateOleObject'"
> Where cani find some documentation to correctly create the Outlook objects
> Venkatesh

You don't treat them any differently to any other .NET object you
shouldn't use OleVariant and you shouldn't use CreateOleObject. 
It should go something like:

var
  o:Outlook;
begin
  o := Outlook.Create;
  ...
  
(I am not sure what the name of the class is)

-- 
Marc Rohloff [TeamB]
marc rohloff -at- myrealbox -dot- com
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads