Solved

word file

Posted on 2000-04-17
11
139 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
 
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

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…
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 will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …

920 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now