Code Monkey home page Code Monkey logo

fill_docx's Introduction

fill_docx

一款基于excel数据批量自动填充word文档的小工具

GUI

开发背景

我们经常会面临批量生成文档的需求,可以使用word自带的邮件填充实现。但对于某些场景:如马拉松比赛成绩证书批量生成,要将文档转换为图片格式,会带来很大的工作量。

各种大型赛事公司想必都有自己的工具软件,但苦于没找到开源素材,所以只能自己动手用python搓了一个小工具。除了基于excel批量填充外,还包含了生成pdf和图片的功能。

使用方法

1. 安装python环境

  • 可以基于anaconda创建虚拟环境,根据requirements.txt里面的第三方库包进行安装。

    conda create -n fill_docs python=3.11.2
    conda activate fill_docs
    pip install -r requirements.txt
  • 然后直接运行即可

    python fill_docx.py

2. 使用打包好的程序

process

注意事项

如下图所示,对应excel列名在word模板里需要

  1. 用英文方括号 [] 括住

  2. 单独放在一个文本框内,避免混乱

  3. 文本框设置好字体字号颜色,最好设置居中以保证最佳效果

sample

后续计划

  • 设置输出文件夹可选——目前默认同目录
  • 支持选择是否导出pdf与图片——目前默认全部导出
  • 设置自定义命名项目(姓名、编号等)——目前默认第一列
  • 研究Nuitka打包为轻量级快速exe

fill_docx's People

Contributors

renzehua1998 avatar

Watchers

 avatar

Forkers

qlmgg

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.