Solved

Linking MSWord and MSExcel with delphi

Posted on 2002-06-03
5
206 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
ID: 7053363
what database? and what you mean: "dynamically"?
Is it some kind of word<-->db<-->excel convertor?
0
 

Author Comment

by:mamello
ID: 7053755
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
ID: 7055446
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
ID: 9010438
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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Can Viruses spread while transferring Binary data with Winsock 2 90
tidtcpserver connection lost handle 2 103
update joined tables 2 55
DBCtrlGrid, Delphi, Scroll 7 26
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…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

820 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