Sha256: a07830b0f1f235d92008ef8eaa8f16d878653a305ffdb50b776f00225f2010cb
Contents?: true
Size: 883 Bytes
Versions: 3
Compression:
Stored size: 883 Bytes
Contents
#!/usr/bin/env ruby require "consolidate" if ARGV[0].nil? || ARGV[0] == "" puts "# Standard::Procedure::Consolidate" puts "## Mailmerge for simple Microsoft Word .docx files." puts "" puts "Create a new file with the mailmerge fields replaced by the data you have supplied" puts "USAGE: consolidate path/to/myfile.docx path/to/mynewfile.docx \"field1=value1\" \"field2=value2\" \"field3=value3\"" puts "" else input = ARGV[0] output = ARGV[1] data = {} verbose = false 2.upto ARGV.length do |index| arg = ARGV[index] next if arg.nil? if arg.strip == "verbose" verbose = true else pieces = arg.split("=") key = pieces.first.strip value = pieces.last.strip data[key] = value end end Consolidate::Docx::Merge.open input, verbose: verbose do |doc| doc.data data doc.write_to output end and nil end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
standard-procedure-consolidate-0.3.1 | exe/consolidate |
standard-procedure-consolidate-0.3.0 | exe/consolidate |
standard-procedure-consolidate-0.2.0 | exe/consolidate |