Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to use the Word components on the server pallette

Status
Not open for further replies.

earlrainer

Programmer
Mar 1, 2002
170
IN
Hi,

Can you give me a small example how to use the Word components on the server pallette.

I cant find any information how to use them.

Please show me how to open and save a word document.

Thanks
 
I think that's what going on in this thread:
Thread102-626325

In the past I've used OLE, but I'm going to start using the components in the future. Let me know how they work out for you!

leslie
 
hey Les,

is'nt it surprising how badly it is documented, even though it such an useful feature
 
There doesn't even seem to be any help available on this.

I found this on Google


from Deborah Pate (who seems to answer all the OLE automation questions on Borland.Public), but I am blocked from this site (and all international sites) by my friendly neighborhood network management section. It probably has useful information.

uses
Variants, Word2000.pas;

var
Word: TWordApplication;
Doc: TWordDocument;
..
Word.Connect;
Word.Visible := True;
Doc.ConnectTo(
Word.Documents.Open('Filename.doc',
EmptyParam, EmptyParam,
EmptyParam, EmptyParam, EmptyParam,
EmptyParam, EmptyParam, EmptyParam,
EmptyParam, EmptyParam, EmptyParam));
Doc.SaveAs('NewFileName.doc');



Brian
"There are 2 kinds of people in the world, those that divide people into two groups and those that don't. I belong to the second group." - tag line I stole
 
Deborah Tate answers lots of questions on the OLE and knows alot. Like I said, I haven't used the components because I really couldn't find much info on them, I have gotten pretty good at using the OLE object and have lots of examples for using it! I think that using the component is "early binding" while using the OLE object is "late binding". As far as any difference in performance, I really don't think there is any. Let me know if you want some samples.

Leslie
 
Brian,

did you ever get this to work out for you? What did you do? I've tried importing the Word library, but I get a fatal error about not being able to create the output file.

Thanks for any info,

Les
 
I have Delphi 6, which apparently can not generate the type library for Word. If you have delphi 5 or 7, this allegedly works fine. All the word stuff we have was done back in Delphi 3 (before the server tab, if memory serves). It is probably not as easy as using the server objets, if for no other reason than we do not get "Intellisense" (or whatever borland calls that dropdown of available objects/properties/functions).
We currently do it sort of like this (we don't really do all this in one function):

var
WordObj:variant;
begin
WordObj:=CreateOleObject('Word.Basic');
WordObj.FileNew("C:\MyTemplateFileName.dot");
WordObj.FileSaveAs(Name:="C:\MyWordDoc.Doc",Format:=0);
WordObj.FileOpen("C:\MyWordDoc.Doc');
WordObj.DocClose(1);



Brian
"There are 2 kinds of people in the world, those that divide people into two groups and those that don't. I belong to the second group." - tag line I stole
 
That's the way I've been doing it, but really wanted to learn the other way, but as you've guess we have Delphi 6. I believe we have ordered 7, but haven't gotten it yet.

Oh well, I'll just keep doing it the way I already know. Will make the coding go faster!

Thanks!
Leslie
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top