Merging using RTF data sources

J

Jason L

Using Word 2002.

Hi, I have a client who has a Coolplex C++ program that is
sending data they need to have merged with a Word
template. Because this information is sent from a C++
program, it's formatted in RTF. Only one file is sent at a
time, and each file has 8 data fields in it. Pretty
simple, huh? Well, the problem is in the formatting of
the file. Each field, space, dash, comma, etc is
surrounded by frames. When I try to select all and paste
special into a Word document, it inverts and screws up the
order of the file. The fields need to be in a certain
order to match up with my header file. Does anyone know
how to make RTF formatted data source files usable for a
template?
-Jason

Here is an example of the data file (I asked him to use
tildas as the field delimiters):

52088241 ~
104-149-003 ~
NameofProject ~
NameofFirm ~
Address1 ~
Address2 ~
Location ~
TotalContractAmt ~
| (a pipe ends the record)

Thanks for any help you can give. Let me know if you have
any further questions.
 
P

Peter Jamieson

Not sure I have completely understood, but if the C++ program is outputting
the file you want to use as a data source, then there may have been some
misunderstanding about the requirements, because...
Because this information is sent from a C++
program, it's formatted in RTF.

....there's nothing about C++ that would require the data to be output in RTF
format. In fact, I'd say it would be quite an effort for someone to write an
rtf-only export. If the problem is that the only useful way the program
(whatever it is) can export data is in RTF, that's a different matter.

So I'd pursue that line first.

If you're stuck with the RTF, there are two main ways you could try to get
the data:
a. use Word VBA to open the .rtf file and programmatically extract the
data. It sounds as if you're saying that this is impossible, but I wonder if
things look a bit clearer if you simply open the .rtf file in Word rather
than cut/paste?
b. write some code to open the .rtf file (they are just text files) after
you had worked out which bits of the rtf were just display-related (e.g.
frames etc.).

Neither of those is particularly easy, but if you despam my e-mail address
and e-mail me a sample I may be able to suggest a workable approach.
 

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