For Programmers: Free Programming Magazines  


Home > Archive > Cobol > February 2006 > Re: ouvrir un document word à partir d'un









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: ouvrir un document word à partir d'un
James J. Gavan

2006-02-22, 6:55 pm

2jo wrote:
> OK Jimmy
>
> Thanks a lot
>
> Now I can do a mass mailing, to do it i use a 'macro' which make the
> mass mailing and and i call this macro from my COBOL program
> The mass mailing can be send to a printer, to a new document or by
> mail... I know how to do this thanks to your help and thanks to forums
> My problem now is that I want to change the printer, I try to do this
> with COBOL but I'm not able to do this...Have you got some help?
>

I'll answer them both in one message. If I don't give you anything here
that helps then *definitely* join the Micro Focus Forum posting your
questions under Net Express.

Firstly the macro business. (I'm going purely from memory having used
WordPerfect over ten years ago - but NOT with COBOL. Both word
processors have similar facilities). I took a very quick look at the MS
Word Documentation - lots of examples and I believe sample data files
that you can test with. The particular feature you are after is "Mail Merge'

1. Word requires two files, Letter.doc and Addresses.doc both in MS Word
format. Having set up those two files, I'm pretty *certain* that
Letters.doc has to be given the file-pathname of the file Addresses.doc.
So suggestions.

2. Don't use COBOL - just MS Word; look at a mail merge demo and I
*think* if you instruct Letters.doc to print it will automatically
reference Addresses.doc.

3. Having got a handle on that. By COBOL program create you own
Addresses.doc - I'm using pseudo methods:-

(a) invoke MSWord "open empty" using filename returning MyAddresses.doc
(object reference)
(b) From your database, assemble each individual address block of
information
(c) invoke MyAddresses.doc (object reference) "insert" using this
address-text-string(containing appropriate control codes); repeat Step(c)
(d) invoke MyAddresses.doc "close file"
(e) invoke "open existing-file" using Letters.doc filename returning
MyLetters.doc (object reference)

4. I think you may find that the next step does it -
invoke MyLetters.doc "print" - the repetitious printing is in
MyLetters.doc telling it go back and repeatedly reference Addresses.doc

5. I don't remember the terminology but I believe 'Control Codes' When
you are typing in MS Word (or WordPerfect for that matter) you can
instruct the software to display the control codes for what you have or
are currently typing, like page-break, indentations, tabbing, changing
style, colour, size, font etc.

Now when I wrote above - "insert" using this address-text-string
(containing appropriate control codes), you have to ensure the lines of
your address block have the appropriate markers - control codes


> Now I can do a mass mailing, to do it i use a 'macro' which make the
> mass mailing and and i call this macro from my COBOL program
> The mass mailing can be send to a printer, to a new document or by
> mail... I know how to do this thanks to your help and thanks to forums
> My problem now is that I want to change the printer, I try to do this
> with COBOL but I'm not able to do this...Have you got some help?
>

There are PC_PRINT/PRINTER routines but I don't think they are going to
help you here as the document to be printed is within MS Word. Check out
the routines.

You can set your printer and PC_PRINT_FILE using filename etc. Somehow I
don't see it triggering the mail-merge in the MS Word Letters.doc file.
If by some extreme luck it does work - then you have an easy solution.

Ask for help in the Forum on changing and identifying printers - there
maybe examples but likely they will give you an API routine to do it.

Jimmy
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com