Mailmerge Filter (how to create separate docs)
November 17, 2006 12:16 PM   Subscribe

I'm doing a code review and I'm keeping track of my findngs on an Excel spreadsheet. I need to generate reports that show vital details about the source code file being reviewed. Unfortunatley, as far as I can tell, MS Word 2003 generates one Word doc that has all oft he merged content in one file. How do I get it to create separate documents?

So, if I my spreadsheet has a.jsp, b.jsp,, d.c, I want to generate 4 separate Word docs. Not 1 Word doc that has all 4 pages of the review document of each source code file!

This is a real hassle to do manually because there are several hundred files being reviewed and I just can't believe there isn't an easier way to do this than to go and cut and paste 4 pages at a time and save to a separate file!

Bonus: If it would name the file automatically given a merge field. (e.g. if the code being reviewed is "home.jsp" then name the file, "Review of home.jsp.doc" that would be great...

posted by apark to Computers & Internet (8 answers total)
Your description doesn't really make any sense.
posted by skwm at 1:29 PM on November 17, 2006

Your spreadsheet is set up as a table with one column being the name of the source code file, and then further columns being info about the source code? Your goal is to create separate Word docs, one for each entry in the table, that summarizes the info in each row of your Excel sheet?

If you're reviewing code, I assume that you know how to code. Why not just write some quick VBA code to read each row, create a new Word doc, then dump the data into it and format it however you want?
posted by skwm at 1:32 PM on November 17, 2006

In your template, put the source file name at the beginning of the page, and a special character sequence at the end of the page (a page break probably works)

Export the generated merge file to text.

Use perl or similar to write a new file each time it sees the special character, naming that file after the source file name.

Import each text file back into word, save as a doc.

Next time: add the code reviewed as a comment in the source file, use doxygen to generate a HTML reference to the code which includes your code review.

Question: are you yourself a programmer?
posted by orthogonality at 1:33 PM on November 17, 2006

Response by poster: Yes, I am a (rusty) programmer. All of these solutions are fine. However, I'm not enough of a MS Office programmer to quickly bang out a macro/VBA code and time is short.

I'm irritated more than anything that Mailmerge doesn't do something that I would consider pretty basic...

Not to sound ungrateful, but "Why don't you just write code" answers are not really helpful. I already know that I could write code to accomplish this.

I wanted to know if there was some option in MS Word that I was missing or if someone already wrote code to accomplish this...
posted by apark at 1:53 PM on November 17, 2006

Why not just use an Access report instead?
posted by mrbugsentry at 2:10 PM on November 17, 2006

Mail-merging is normally done so that one can print out a large number of similar items, so it wouldn't make sense for it to make multiple documents. The easiest thing is for it to make one very long document with pagebreaks. So I'm afraid I think it isn't a basic feature, it's you who's got an unusual requirement.
posted by AmbroseChapel at 10:17 PM on November 17, 2006

Response by poster: To: AmbroseChapel: Are you perhaps on the MS Word Development Team or somethng? Whether my problem is unsual or not, your answer above does nothing to help solve my problem.

After Googling around, I found this page written by an MS Word MVP so I guess other have similar needs as I do...

Oh well, to each their own.
posted by apark at 10:21 PM on November 19, 2006

>Whether my problem is unsual or not, your answer above does nothing to help solve my problem.

No, it doesn't. But it does help you with this problem, presumably:

>I'm irritated more than anything that Mailmerge doesn't do something that I would consider pretty basic...

You ought to be less irritated now that you understand. Clearly that hasn't happened...
posted by AmbroseChapel at 8:14 PM on November 21, 2006

« Older Being woken by nighttime painful erections.   |   Hotel Seattle/SanJose? Newer »
This thread is closed to new comments.