Skip to content

Instantly share code, notes, and snippets.

@adamcheasley
Created May 29, 2019 09:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adamcheasley/fd4397260df4608587a372bca0f1f77a to your computer and use it in GitHub Desktop.
Save adamcheasley/fd4397260df4608587a372bca0f1f77a to your computer and use it in GitHub Desktop.
import docx
from docx.shared import Inches
doc = docx.Document()
table = doc.add_table(rows=2, cols=2)
table.style = 'TableGrid'
table.autofit = True
table.cell(0, 0).text = 'Time Zone'
table.cell(1, 0).text = 'Link'
table.cell(1, 1).text = 'https://www.google.com/'
for cell in table.columns[0].cells:
cell.width = Inches(0.2)
doc.save('test3.docx')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment