Solved

Linking MSWord and MSExcel with delphi

Posted on 2002-06-03
5
203 Views
Last Modified: 2010-04-04
1. I want to load database fields into a MSWord document dynamically, so how do I go about doing this? Please provide example.
2. I want to load data from a MSExcel spreadsheet into the database and rows made into columns dynamically.How do I go about doing this. Please provide example.
0
Comment
Question by:mamello
5 Comments
 
LVL 3

Expert Comment

by:Slavak
Comment Utility
what database? and what you mean: "dynamically"?
Is it some kind of word<-->db<-->excel convertor?
0
 

Author Comment

by:mamello
Comment Utility
1. I want to load database fields into a MSWord document, so how do I go about doing this?
Please provide example.
2. I want to load data from a MSExcel spreadsheet into the database and rows made into columns .How
do I go about doing this. Please provide example.
I am using interbase for the database
0
 
LVL 6

Accepted Solution

by:
swift99 earned 100 total points
Comment Utility
What database doesn't matter.

Word and Excel are both COM objects, so they can be invoked via the COM interface.

I usually write the core of the code as a VBA script and then translate it to Delphi.  This example is not guaranteed to be more than close, since I'm running on the linux side right now and can't check my Delphi help files.  However, it encapsulates the intent of what I am trying to put across.

Procedure HelloExcel;
var
    aWorksheet: Variant;
begin
    CreateObject ('ExcelNoteBook', aWorksheet);
    aWorksheet.Cells]1,1] := 'Hello, World';
    aWorkSheet.SaveAs ('Hello.xls');
    aWorksheet.Close;
end;


You can also set formulas, styles, and so on.  Use your Excel and Word online help, and remember that although the API is the same for Delphi and VBA the languages are different.  Arrays are delimited by () in VB and by [] in Delphi for example.

0
 
LVL 1

Expert Comment

by:pnh73
Comment Utility
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

Accept answer from swift99

Please leave any comments here within the next seven days.
 
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
 
Paul (pnh73)
EE Cleanup Volunteer
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now