Solved

Linking MSWord and MSExcel with delphi

Posted on 2002-06-03
5
207 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying 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
Delphi Spellcheck in Webbrowser 1 76
error 1.1 400 Bad request idhttp delphi 18 268
Help on project with Soap 10 68
Delphi Mdi application Child forms get behind control 7 355
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

739 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