Solved

word file

Posted on 2000-04-17
11
140 Views
Last Modified: 2010-04-04
How can I open a word file in my application, edit a small word, and save the file to a database?
0
Comment
Question by:cando
  • 4
  • 3
  • 3
  • +1
11 Comments
 
LVL 2

Expert Comment

by:mullet_attack
ID: 2725136
You don't say if you want to edit the doc manually or via code, but either way you could use OLE automation to open and edit the word doc. (TOLEContainer). If you have D5, have a look at the word components on the 'servers' tab. For info about methods etc to use, have a good read through the relevent ???_TLB.pas files.
If you're using an Access DB, save the doc to an OLEObject field.

for good info on automation, have alook at http://www.djpate.freeserve.co.uk/Automation.htm
0
 

Author Comment

by:cando
ID: 2725198
the document would be edited via code. I would like the answer to to be non resource intensive and not add a whole lot of size to the file, but if i have to use ole, thats ok.
0
 

Author Comment

by:cando
ID: 2725201
the document would be edited via code. I would like the answer to to be non resource intensive and not add a whole lot of size to the file, but if i have to use ole, thats ok.
0
Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

 
LVL 2

Expert Comment

by:mullet_attack
ID: 2725224
If you want to edit the word doc, I think you must use OLE (COM), unless when you say "edit a small word" you mean change ocurrance of word "Master" to "Mister" for example, you could probably do that at the binary file level. Using COM is not really resource intensive, however it does mean that the user must have word, and depending on what you are doing, starting and stopping Word may be a bit time-consuming.
0
 
LVL 3

Expert Comment

by:bryan7
ID: 2725304
listenning
0
 
LVL 15

Accepted Solution

by:
simonet earned 400 total points
ID: 2725407
Here's an "How-To" Project I wrote a while ago that does exactly that.

http://www.bhnet.com.br/~simonet/extras/oledb.zip

Full source code is included.

Yours,

Alex
0
 

Author Comment

by:cando
ID: 2729392
isn't there a way to do it without using ole?
0
 
LVL 15

Expert Comment

by:simonet
ID: 2729409
If you need in-place editing or displaying the file contents, the answer is "no".

If you simply want to manipulate the file outside your application, you can use The Automation objects, but that's still OLE.

Alex

0
 
LVL 2

Expert Comment

by:mullet_attack
ID: 2730799
Yes you can do it without using OLE.

1. obtain full specification of MS Word document.
2. Write your own editor to use that specification.

I guess using OLE would be easier !

BTW, why the objection to using OLE (COM) ?  your PC is using multiple com servers etc every time you run Windoze.
eg Outlook has about 8 or 9 COM objects and virtually everything exporer does is com (via shell)...
0
 

Author Comment

by:cando
ID: 2733072
I dont really want to use ole because it is a client server application and not all of the computers would have word installed on them.
0
 
LVL 15

Expert Comment

by:simonet
ID: 2733121
Well, the solution is to keep ALL the Word files compatible with Word95, so you can use WordPad instead of Word to edit the files. WordPad comes with Windows, so it will cost you nothing, and can open/edit/save Word95 files.

Another option is to use RTF files, which would be a much simpler approach than using Word files. If it's up to you to decide, use RTF files instead . In that case you can simply use a TRichEdit, or get a TDBRichEdit from Delphi Super Page.

Yet another option is to use StarOffice on the computers that don't have MS Office. StartOffice word processor can edit Word97 files, but I don't know if StarOffice is OLE-enabled.

Other than the choices above, there's no way you can edit a Word file without having Word installed. Doing so would be against MS' EULA. Besides, if you can edit a Word file without Word, why would you need Word at all, to start with?

Yours,

Alex
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
code issue 8 129
creating threads in delphi 1 104
firemonkey keyboard covers the controls 1 25
Delphi problems to abort a printjob 9 19
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…
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…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.

770 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