Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can one add graphics to pages from image files in merge?

Status
Not open for further replies.

herbc

Programmer
Jun 24, 2001
8
0
0
US
I can't find anything about whether one can display graphics from image files on pages with merge or macro. I need to dispaly a specified or a default image file on each page. Can anyone help me on this? I would very much appreciate any comments/ideas/code or anything.

Thanks,
Herb
 
What version of WordPerfect are you using? Do you want to merge a graphic file into a page at a certain location and a certain size?

Provide me with a little more information about what you want and I will see if I can help you.

Thanks!
 
I really appreciate any help I can get. I am using WP8. I need to process a Merge data file with two fields per record. Field 1 contains a name or title. Field 2 contains the Path and filename for an image file. I need to display Field 1 as text in the output file. I need to display the image, which field 2 points to, as an image in the output file. I need to do this to at least two different files, possibly more.
I know that I can add the image as content to a graphics box manually to the output file if I have to. I have about 100 records involved per file, so I want to do the manual operation only as a last resort. It looks to me as though it is possible to do this with Macro commands inside a Merge form file; I think I know some of the commands I need to use, but I have only a very basic idea of how to go about doing it.
I would very much appreciate any help you can give me. I am approaching some deadlines on finishing it.

Herbc
 
You can do this in WordPerfect 8 by using the EMBEDMACRO command to insert the graphic image where you want it. Your data file will look something like the following:

FIELDNAMES(Text;Image)ENDRECORD
===================================================
This is a test to see what will happen!ENDFIELD
C:\COREL\SUITE8
\GRAPHICS\PICTURES\BUSINESS\DOCUMENT.BMPENDRECORD
===================================================
This is a second test to see what happens!ENDFIELD
C:\COREL\SUITE8
\GRAPHICS\PICTURES\BUSINESS\WORLD.BMPENDRECORD
===================================================

The form file will look something like the following:

FIELD(Text)

See the image > ASSIGN(image;FIELD(Image))EMBEDMACRO
(BoxCreate (BoxType:"I&mage")BoxContentType (Content:Image!)
BoxImageRetrieve (Action:MakeInternal!; image )
BoxUpdateDisplay ()BoxEnd (State:Save!))


The ASSIGN command will assign the contents of FIELD(Image) to the variable "image". The EMBEDMACRO command then executes the contents of the macro commands in order to insert the image into the document. The (Action: MakeInternal!; image ) command inserts the path and filename assigned to variable "image" that it received from FIELD(Image). This command works really well for inserting images into your document.

The ASSIGN and EMBEDMACRO commands are both found on the Merge Codes list. The rest of the command can be typed in manually.

I hope this helps!
 
I really appreciate your help. I have made a couple of test files, following your suggested code. When I run the Merge, it sees a Macro Error in the BoxImageRetrieve command. I don't have any idea what is wrong. Is there a way I can send the test files to you, rather than retype them? The system won't let me use COPY and PASTE. All it will PASTE is the "See the image" text; nothing more. I can sure use some more help.

Herbc








 
Send the files to davidag@altavista.com and I will see what I can do with them.

The text "See the image >" is not part of the macro. I just put it in the document as text to point to the graphic image when the image is merged into the document. The other commands need to be inserted with the merge command inserter. I can modify your files and send them back. Place a marker in the form file indicating where the graphic image needs to go in the following format:

<graphic goes here>

I will remove the &quot;<graphic goes here>&quot; string and replace it with the appropriate coding for merging in the graphic image. Let me know what fieldname or or field number needs to be merged into the document for the graphic images.

Thanks!
 
I thank you again for your help. I did send an email to the address you gave me, with the test files I made attached, on Thur., the 26th. I had used just the test files you suggested at that point. I am wondering now if you got the email; perhaps it got lost among the volume of messages you probably receive. It came from: jhcrary@earthlink.net. I can easily send it again if needed. Please let me know if you need any other information, etc. I am trying to get this ready for a meeting on Wed., so the timing is getting a bit tight.

Herbc
 
I have sent back the files that you sent me with some corrections. The EMBEDMACRO command was creating a problem. It must be selected from the Merge Codes dialog box. Unlike the commands from BoxCreate to BoxEnd, it cannot be typed in. It must be inserted like other merge commands.

Information for creating a file to merge graphic images into:

The best method for inserting a graphic image into a document is by defining a character anchored graphic style. To do so, click on &quot;Graphics&quot; from the pull-down menu and choose &quot;Graphics Styles&quot; at the bottom of the pull-down menu. In the &quot;Graphics Styles&quot; box click on &quot;Create&quot;. Type &quot;Ch&aracter Box&quot; in the &quot;Style name:&quot; box (make sure that you add the &quot;&&quot; character in the name). Next, click on the &quot;Position&quot; button and then choose &quot;Character&quot; for the &quot;Attach box to:&quot; option and click &quot;OK&quot; Choose the type of &quot;Border&quot; that you want for the box by clicking on &quot;Border/Fill&quot; and then &quot;OK&quot; the choice. Then click &quot;OK&quot; to finish defining the new graphic style that you created. You should now see &quot;Character Box&quot; on the list of styles. Next, click on the &quot;Menu&quot; button and scroll to the bottom of the list and check the &quot;Character Box&quot; style to make it available on the graphics menu and click &quot;OK&quot;. Then click on the &quot;Close&quot; button. Now if you click on the &quot;Graphics&quot; pull-down menu, you will see &quot;Character Box&quot; as an option. Now use the following form file format to use the newly created &quot;Graphic Style&quot;:

FIELD(Text)

See the image> ASSIGN(image;FIELD(Image))EMBEDMACRO(
BoxCreate (BoxType:&quot;Ch&aracter Box&quot;)BoxImageRetrieve
(Action: MakeInternal!; image )BoxUpdateDisplay ()BoxEnd
(State:Save!) PosLineEnd ())

Note: The FIELD(Text), ASSIGN(image;FIELD(Image)) and the
EMBEDMACRO() commands must be inserted using the Insert
Field and Merge Codes options on the merge toolbar. All
commands from BoxCreate to PosLineEnd() command can be
manually typed inside of the braces of the EMBEDMACRO()
command.

I hope that this is helpful.
 
I really appreciate all the help I have received. Unfortunately, I was unable to get the macros to work the way I needed. I was able to do what was really necessary manually, as I had to turn what I was doing on that last project over to the printers last Wed.
I have another, similar problem to solve now. I have about a week to work it out. What I need to do this time is to produce an output file from Merging a data file with a .frm file containing a graphic box (plus other commands, of course). I need to print a name from three fields in the data file, which I have already worked out.
The problem again concerns the graphic. I have default image content already loaded in the box in the form file. I need to check to see whether or not a file string is present in one specified field. If so, I need to load the image in the file specified by the string, so it will appear in the box on the output file.
What I need it a set of MACRO commands to do this. I think that I have some of what I need - the ASSIGN command to place the file string in a variable appears to work, according to the MACRO Debug results. I have been using the BoxImageRetrieve command and some others previously suggested. It appears to put the compiler in a loop which I have trouble stopping. The box never appears on the output file. I hope that I can get some clues about other commands I need to use. I probably need help with some of the syntax too. I would sure appreciate some further help.

Herbc
 
You should be able to accomplish what you want by doing something like the following:

ASSIGN(num1;1)WHILE(VARIABLE(num1)>0)FIELD(Text)

See the image> |||
< . . >
(/o\)
(V)
|

ASSIGN(image;FIELD(Image))IF(VARIABLE(image)=C:\COREL\SUITE8
\GRAPHICS\PICTURES\BUSINESS\DOCUMENT.BMP)EMBEDMACRO(
BoxEdit (BoxNumber: num1) BoxImageRetrieve (Action:
MakeInternal!; image)BoxUpdateDisplay ()

BoxEnd (State:Save!) PosDocBottom ())ENDIF Did the Image
Change? ASSIGN(num1;VARIABLE(num1) +1) [HPg]
------------------------------------------------------------NEXTRECORD ENDWHILE

Note: The [HPg] is a regular hardpage at that point in the document. The NEXTRECORD and ENDWHILE codes follow the page break on the next page. The little graphic that I drew represents the graphic image that you already have in your document. You will notice that the EMBEDMACRO command is using the BoxEdit command to edit the image. The ASSIGN command is used to create a counter named num1 that increments once for every record. It is used to edit the image assuming that you only have one image in the form file. You will also notice that the image will only be changed from the original image to the one designated in your .dat file if VARIABLE(image)=C:\COREL\SUITE8
\GRAPHICS\PICTURES\BUSINESS\DOCUMENT.BMP

The .dat file will look like the following:

FIELDNAMES(Text;Image)ENDRECORD
===================================================
This is a test to see what will happen!
ENDFIELD C:\COREL\SUITE8
\GRAPHICS\PICTURES\BUSINESS\DOCUMENT.BMPENDRECORD
===================================================
This is a second test to see what happens!ENDFIELD
C:\COREL\SUITE8
\GRAPHICS\PICTURES\BUSINESS\WORLD.BMPENDRECORD
===================================================

The steps for creating the form file and the data file are the same as in the other examples given above.

Hope this helps!
 
I'm trying to do much the same thing but have an &quot;if not blank&quot; issue as well and I'm using WP11. I've made a series of screen captures in case I type something wrong here.

First is the data that is being merged:
NameID;last;first;connections;updated;notes;private;photo;WebYN

You said: &quot;The best method for inserting a graphic image into a document is by defining a character anchored graphic style&quot; I named mine ABCphotos instead of the Ch&aracter Box that you called it.

Next is the merge code IFNOTBLANK(photo)ASSIGN(photo;FIELD(photo))EMBEDMACRO(BoxCreate (BoxType:&quot;ABCphotos&quot;)BoxImageRetrieve (Action: MakeInternal!; photo )BoxUpdateDisplay ()BoxEnd (State:Save!) PosLineEnd ()
FIELD(last), FIELD(first)
IFNOTBLANK(connections)Connections: FIELD(connections)ENDIF

ENDIF

I've got a feeling that my ifs and end ifs are messing me up. In any case, what I want in English is:
If the photo field is not blank, then make a graphic box with the image from the path, then type the last name followed by a comma then the first name. In addition, if the connections field isn't empty, then type Connections: followed by the content of the connections field.

Now, what is happening is that when I merge, I'm getting as far as the third record - which is the first one that a path in the photos field, and I get:
&quot;The macro is being canceled because of an out of range token completion code error condition processing product command 'WordPerfect.BoxImageRetrieve'.
Check line 2 of macro file 'WP}00003.TMG'&quot;

And it won't let me quit - I have to end task to get out of it. Debugging doesn't give me much more info, and I still have to end task. Once I end task for WP, then PerfectScript shows up in the tasks and I have to end task that as well.

So, what am I doing wrong?

Kathryn Bassett - kathryn@bassett.net
 
I got some off-list help with my problem from someone at the wpuniverse forum, and now have solved my problem. If you are interested in the answer, write me and I'll send you the .frm with the code that finally worked.
kathryn@bassett.net
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top