My suggestions are based on the assumption, that your "Word template" is simple enough to recreate (for example, you are required to merge your Excel output into a .doc file with some header, footer and basic table formatting).
Excel data saved as a tab delimited file is just a tab delimited file. So, don't focus on the origin of the data and use Text::CSV to read the file. If the module documentation seems too detailed, here is a nice tutorial.
Remember to tell the module that you are dealing with tab separated fields:
my $csv = Text::CSV->new ({sep_char => '\t'});
When you're done with input, the only thing left is to print the data to a file your Word users can read. I would suggest using RTF::Writer, and saving the RTF file with a .doc (or .docx) extension. Word will open the file without problems, and if you do not need any special formatting, it should be enough.
Tables in RTF are a bit tricky, but if your needs are simple, the following snippet from the module documentation should help you:
my $decl = RTF::Writer::TableRowDecl->new('widths' => [1500,1900]) +; $h->row($decl, "Stuff", "Hmmm"); $h->row($decl, [\'\ul', 'Foo'], 'Bar', \'\bullet'); $h->row($decl, "Hooboy.");
Hopefully, this will be of some use to you. Good luck!
regards,
Luke
In reply to Re: Merge Excel data with Word Template
by blindluke
in thread Merge Excel data with Word Template
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |