Esempio n. 1
0
def main(choice):
    if choice == '1':  # 批量写入文本形式
        while True:
            print("请输入模板文件绝对路径:")
            formatpath = input()
            try:
                batch_word_text.main(formatpath)
                break
            except Exception as err:
                print(err)
                print("请检查文件路径是否正确")
    elif choice == '2':  # 批量写入表格形式
        while True:
            print("请输入模板文件绝对路径:")
            formatpath = input()
            try:
                batch_word_table.main(formatpath)
                break
            except Exception as err:
                print(err)
                print("请检查文件路径是否正确")
Esempio n. 2
0
    if choice == '1':  # 批量写入文本形式
        while True:
            print("请输入模板文件绝对路径:")
            formatpath = input()
            try:
                batch_word_text.main(formatpath)
                break
            except Exception as err:
                print(err)
                print("请检查文件路径是否正确")
    elif choice == '2':  # 批量写入表格形式
        while True:
            print("请输入模板文件绝对路径:")
            formatpath = input()
            try:
                batch_word_table.main(formatpath)
                break
            except Exception as err:
                print(err)
                print("请检查文件路径是否正确")


if __name__ == "__main__":
    choice = enter_choice()
    if choice == '1':  # 批量写入文本形式
        formatpath = 'template_text.docx'
        batch_word_text.main(formatpath)
    elif choice == '2':  # 批量写入表格形式
        formatpath = 'template_table.docx'
        batch_word_table.main(formatpath)