Tech or Treat! Write an article about your scariest tech disaster to win gadgets!Learn more

x
?
Solved

Linking MSWord and MSExcel with delphi

Posted on 2002-06-03
5
Medium Priority
?
212 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 400 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Suggested Courses

647 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