By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,078 Members | 1,733 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,078 IT Pros & Developers. It's quick & easy.

Modifying a Word document without using Word Automation

P: n/a
I know that using Word Automation inside an ASP page is no good idea.

Anything I want to do in the current project is: open document, change some
text, save and close document. Basically changing some variables, consting
of a name embraced by special chars, to some value. As for example: change
"[FirstName]" to "Michael".

Does anybody know whether there is a way for achieving this with basic "file
input / output". Can I regard a Word document as some binary data, perform
the replacement, and save the data, without destroying Word's internal
structure?

Michael G. Schneider
Jul 19 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
"Michael G. Schneider" <mg**********@mgs-software.de> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
I know that using Word Automation inside an ASP page is no good idea.

Anything I want to do in the current project is: open document, change some text, save and close document. Basically changing some variables, consting
of a name embraced by special chars, to some value. As for example: change
"[FirstName]" to "Michael".

Does anybody know whether there is a way for achieving this with basic "file input / output". Can I regard a Word document as some binary data, perform
the replacement, and save the data, without destroying Word's internal
structure?


Not the binary version of the Word file. However, if you use RTF files, they
are parseable text. RTF supports most of Word's features, and can nearly
fully contain its formats. You'd be well advised to use RTF files in the
workflow you are considering. The binary DOC file format is unpublished,
you'd have no way of figuring out how to modify it without some serious
reverse engineering skills.

R.
Jul 19 '05 #2

P: n/a
"Richard K Bethell" <so*****@spammingisevil.bad> schrieb im Newsbeitrag
news:O4**************@tk2msftngp13.phx.gbl...
Not the binary version of the Word file. However, if you use RTF files,
they are parseable text. RTF supports most of Word's features, and
can nearly fully contain its formats. You'd be well advised to use RTF
files in the workflow you are considering. The binary DOC file format
is unpublished, you'd have no way of figuring out how to modify it without
some serious reverse engineering skills.


Thank's a lot for the answer.

In a former project I used RTF files for this purpose. Besides not
supporting Word's complete feature set, they had one disadvantage:

I did not find an ActiveX DLL for reading / writing RTF files. So I did the
IO myself. As I did not want to write a full RTF parser, I simply tried to
find my variables inside the RTF stream. However, there were situations,
where a variable name was cut into pieces by matching curly braces. So if
the variable name was "[XYZ]" inside the Word document, inside the RTF a
"[X}{YZ]" could be found.

Michael G. Schneider
Jul 19 '05 #3

P: n/a
> I did not find an ActiveX DLL for reading / writing RTF files. So I did the
IO myself. As I did not want to write a full RTF parser, I simply tried to
find my variables inside the RTF stream. However, there were situations,
where a variable name was cut into pieces by matching curly braces. So if
the variable name was "[XYZ]" inside the Word document, inside the RTF a
"[X}{YZ]" could be found.

You can have a look at myLittleWriter
(http://www.myLittleTools.net/mlw. This is windows script component
which allows to generate RTF files on the fly. It may help you...

Best regards
el.c.
Jul 19 '05 #4

P: n/a
"myLittleTools.net" <we*******@mylittletools.net> schrieb im Newsbeitrag
news:d0*************************@posting.google.co m...
You can have a look at myLittleWriter
(http://www.myLittleTools.net/mlw. This is windows script component
which allows to generate RTF files on the fly. It may help you...


Will the tool allow me to read an existing RTF, then run through the text,
perform some replacements, and then save the RTF? Or must the code create
the RTF from scratch?

Michael G. Schneider
Jul 19 '05 #5

P: n/a
>> You can have a look at myLittleWriter
(http://www.myLittleTools.net/mlw. This is windows script component
which allows to generate RTF files on the fly. It may help you...
Will the tool allow me to read an existing RTF, then run through the
text, perform some replacements, and then save the RTF? Or must the
code create the RTF from scratch?

myLittleWriter is a "writer" and does not allow to read existing RTF
files. You should then create the RTF file from "scratch".

Best regards
el.c.

P.S. : sorry for the email in your own box... i clicked the wrong button

// myLittleTools.net : leading provider of web-based applications.
// myLittleAdmin : online MS SQL manager
// http://www.mylittletools.net
// we*******@mylittletools.net
Jul 19 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.