This project aims to automatically generate nametags to load data from an Excel file and inserting it into a PowerPoint which is prinble format. It reads nametag data from a given Excel file and inserts information for each data into PowerPoint slides based on a provided sample template which designed in PowerPoint.
- Python 3.x
openpyxl
librarypython-pptx
librarytkinterdnd2
library
You can install the required libraries using the following command:
pip install openpyxl python-pptx tkinterdnd2
- Prepare Excel file: Prepare an Excel file (attendess_list.xlsx, for example) containing the information to be included in the nametags. Each row should contain information for one nametag.
- Prepare PowerPoint sample: Prepare a sample PowerPoint file (nametag.pptx, for example) to be used when generating the nametags. For Each sample slide put different layouts and designs for the name badges.
- Run the script: Execute
main.py
Python script to automatically generate the nametags. You can find the generated nametag PowerPointdist/generated-*.pptx
. - Check the result: The executed script will generate a new PowerPoint file. Open this file to review the generated nametags.
- One silde must contain one sample nametag design.
- Text of sample nametag should be one of name of header. Otherwise leave it as is. The script subtitues header text to information text.
python main.py -excel 'example/attendees_list-example.xlsx' -pptx 'example/nametag-example.pptx'
The Excel file containing the necessary information for the nametags should follow a format similar to the following:
Sample Num | Campus | Name | Position |
---|---|---|---|
0 | Ajou Univ | Kyunghyun Min | SoonJang |
1 | ABC Univ | Jane Smith | SoonWon |
The 'Sample Num' column in the Excel file allows you to select from the provided sample templates. sample slide number is start from 0. For basic tamplate, attendess_list.xlsx file.
project-root/
│
├── main.py
├── example.py
├── src/
| ├── gui.py
│ ├── analyze_slide.py
│ ├── draw.py
| ├── morefont_pptx.py
| ├── allow_eastaisa_typeface_pptx.py
│ ├── settable_pptx.py
│ └── utils.py
│
└── template/
├── attendees_list.xlsx
└── nametag.pptx
main.py
: Main scriptexample.py
: Run example based on files in example foldersrc/
: Directory containing source code filesanalyze_slide.py
: analyze shapes in slide. position, image, text, font etc. information are extracteddraw.py
: Draw nametag in pptmorefont_pptx.py
: Extends thepython-pptx
library to add support for user local font directoriesallow_eastaisa_typeface_pptx.py
: Extends thepython-pptx
library to make run.font settablesettable_pptx.py
: Extends thepython-pptx
library to add support for East Asian fonts
template/
: Directory containing template filesattendees_list.xlsx
: Excel file containing the list of attendees information for nametagnametag.pptx
: PowerPoint template for sample nametags. Custom slide layout are applied
This project is licensed under the MIT License. For more information, see the LICENSE file.