| Conditions | 2 |
| Total Lines | 21 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | #!/usr/bin/env python |
||
| 8 | def main(): |
||
| 9 | usage = 'Usage: %prog [options] input.xlsx output.docx' |
||
| 10 | version = '%prog 20161121' |
||
| 11 | parser = OptionParser(usage=usage, version=version) |
||
| 12 | parser.add_option('-i', '--imagedir', metavar='IMAGE_DIR', |
||
| 13 | dest='image_dir', default='image', |
||
| 14 | help='image directory (default image)') |
||
| 15 | parser.add_option('-t', '--template', metavar='TEMPLATE_TYPE', |
||
| 16 | dest='template_type', default='aini2016', |
||
| 17 | help='template type: \'aini2016\' or \'jscpb2016\' (default aini2016)') |
||
| 18 | (options, args) = parser.parse_args() |
||
| 19 | if len(args) != 2: |
||
| 20 | parser.error('incorrect number of arguments') |
||
| 21 | input_xlsx = args[0] |
||
| 22 | output_docx = args[1] |
||
| 23 | template_docx = 'template-' + options.template_type + '.docx' |
||
| 24 | |||
| 25 | abgen = AbstractGenerator(options.image_dir, options.template_type) |
||
| 26 | abgen.read_xlsx(input_xlsx) |
||
| 27 | abgen.write_docx(output_docx, template_docx) |
||
| 28 | sys.exit() |
||
| 29 | |||
| 32 |