Word and excell with delphi 6 - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Word and excell with delphi 6

Hey i'm currently trying to work with documetns from with in my delphi program, i've managed toopen word end excell using the server components giving but i can't open a specific file through the code, i would like it if somebody can helpme.

In the server components the word application has a function open but uses 12 olevariant variables to open, i don't know how to use the ole variant variable and nothing i tried worked here is my code that i've uses sovar...

procedure TForm1.Button1Click(Sender: TObject);
Var
STR1 : _Document;
Doc,Doc1,Doc2,Doc3,Doc4,Doc5,Doc6,Doc7,Doc8,Doc9,Doc10,Doc11,Doc12: Olevariant;
begin
try
try
WordApplication1.Connect;
except on E: Exception do
begin
E.Message := 'Word does not appear to be installed';
raise;
end;
end;
Worddocument1.Connect;
// Worddocument1.Merge('C:doc.doc');
Worddocument1.Activate;
Wordapplication1.ChangeFileOpenDirectory('C:');
Doc := 'C:Doc.doc';//Filename
Doc1 := False;//Confirmconversions
Doc2 := False;//readonly
Doc3 := False;//Addtorecentfiles
Doc4 := False;//password doc
Doc5 := 0;//password template
Doc6 := False;//revert
Doc7 := False;//writepassword doc
Doc8 := 0;//writepass
Doc9 := '';//Format
Doc10 := '';//Encoding
Doc11 := True;//visible
Doc12 := '';
Wordapplication1.Documents.Open(Doc,doc1,doc2,doc3,doc4,doc5,doc6,doc7,doc8,doc9,doc10,doc11);
WordApplication1.Visible := True;


except
on E: Exception do
begin
Showmessage(E.Message);
WordApplication1.Disconnect;
end;
end;
end;


I would be very grateful if someone can help me to understand the olevariant code and to tell me how to open these docs.


I would also like if someone can tell me what that merge procedure actually does cause when i use it the document opens but all the text looks like hyperlinks but does nothing....



Thank you very much ever so grate full

Simon Says
Sign In or Register to comment.