Highlighted
Absent Member.
Absent Member.
876 views

[archive] Mail Merging with Word

[Migrated content. Thread originally posted on 24 June 2004]

Hello All Again,

Based on an event the task I have to achieve is as follows:

Create a 2 page document and email it to our customers customer.

From my previous question I asked the Forum, we now know how to email the said document converting it to mime base 64 accordingly.

To create the said document, do not laugh, but we are doing the following:

Creating an html file, launching Internet Explorer where the user can send it to a pdf printer, then emailing the .pdf file. I tried to find freeware software that could convert te HTML to PDF format automatically, but the 2 page document became 5-7 pages and looked naff.

I went this route, rather then creating a word document, because of the following:

1. .pdf file cannot be easily amended by the reciprient.

2. When I used the example program, it worked for me using Office2000, but not for 2 of my collegues using Office 97 and Office on XP. This apparently because the WORD.DEF file has to be different for the different versions of WORD, and I did not want the hassle of having to keep different versions of the program.

3. I also thought the code was not that simple to understand, although to be honest I did not dwell on it when I found the problems with the definition file.

However, I am now thinking maybe it would be better and possibly easier to do a mail merge, although a .pdf file would be better and possibly more secure as we are embedding signatures into the document.

Has anyone else tried to do something similar? And what do you all think of which route is best to take?
0 Likes
2 Replies
Highlighted
Absent Member.
Absent Member.

RE: [archive] Mail Merging with Word

Interesting stuff.

I am curious, would you mind let us into what were the differences between the two versions of Office? In general the Word COM object should be forward compatible, e.g. using something that worked with Office97, should also work with Office2K.

Now, not that I consider it a big deal if you don't care anyhow, but professionally curious, yes.

As for your mailmerge issues, since you even have thought about using Word, I figure this is going to happen on a Windows machine, in that case, are you aware that you can have the mailmerge perform directly to an email?

Provided you have the email address in one of your cells of the datasource document, all you have to do is to change @Destination from wdSendToNewDocument (wdSendToPrinter) to wdSendToEmail, also provided of course, that a proper email account for sending is set up (which normally is the case when you first have office installed).

Now, another question, since you are looking into html, why don't you keep it html all the way? Why bother translating to pdf?

I do indeed agree with you that .doc is better for secured reasons, as you can protect a document from modifications, which you cannot do with html. for .pdf, I have no idea. Perhaps a search on the Adobe web site can give you some clue, but I doubt.
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Mail Merging with Word

Here are two things to check out.

One is HTMLDOC, which converts HTML to PDF.

See: http://www.easysw.com/htmldoc/

It is GPL'ed software (open source), but I think if you want the command line version of it for Windows, you have to download the source and compile it using Microsoft Visual C/C++, or buy a license to get the compiled binaries from them.

We do not use it from Cobol, but we do use it from a web page to generate PDFs. We write out the data in HTML to a temp file, then run the command line version of HTMLDOC on it to convert it to a PDF, then send the PDF to the browser.

The other is VSVIEW from ComponentOne, which is part of their Studio for ActiveX product. VSVIEW contains a VSPrint ActiveX control, which you can use like the Visual Basic Printer object (if you are familiar with VB) but also has a VSPDF control that works with it, where you can tell the VSPrint control to write the output to a PDF file instead of the printer. This is what we use to write reports to PDF files.
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.