How to merge two raw rtf documents?

I

iconmsdn

Hello All,

We need to merge two rtf documents automatically without the user seeing.
The combined product of this merge is then shown to the user.

Currently we :

open the docs using notepad,
remove the last outer brace from the first doc
and the first outer brace from the second.
We then save them to a new rtf text document and then open this in word.

However this is causing problems with font tables and other items in the
headers of the rtf.

We have tested using Word automation but want to know if there is any other
way or a recommended way of doing this?

We currently do the merging of the rtf on the server side. Moving to using
Word Automation will mean we need to rely on the COM component server side
which as the following link shows is not a good idea:

http://support.microsoft.com/default.aspx?scid=kb;EN-US;q257757#kb2

We are considering moving the merging client side and therefore we can use
Word automation but this does add extra time to the client viewing the
document.

I presume that the method of merging the rtf by removing the braces is a
complete no no? Has anyone ever tried doing it this way? If we can
categorically rule this out we can push forward with the Word Automation.

Thanks for your help
 
P

Peter Jamieson

In the general case it does not work for the reason you mentioned, i.e. at
the top of each RTF file there are tables of fonts and styles which are
referenced in the "body" part of the rtf. The best you can probably do is to
do a little bit more coding to:
a. go through the various tables in the header section of document A
b. strip off the header section of document B
c. apply "document A" names and references everywhere

I have no idea how difficult that would be, but I wouldn't particularly want
to have to make sure it always worked...

Peter Jamieson
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top