Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

word file

Posted on 2000-04-17
11
Medium Priority
?
146 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
[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
  • 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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 1600 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

Tech or Treat! - Giveaway

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

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

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
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 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…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Suggested Courses

597 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