I'm currently attempting a little project where I read from a word document from python, extract each paragraph from the .docx and then output a new word document where those paragraphs are separated into neat boxes atop of one another. Attached is an example of the desired output (of course, in a word document). Of course, attached also is the word document I'm working with (a snippet of it), the code I'm currently working with, as well as what's currently being output from the code when run. This is a bit of a time sensitive project, but thank you for anybody who helps!
EDIT: I've gotten close to my desired output. Now, I just want to remove the indents from each paragraph so that when they're in the box, there is no indent. I'd also like to center all of the text within their 1x1 tables. Additionally, I'd like to make those borders thicker and I'd like the boxes to be a little bit closer together. Using '/r' in this case makes the space slightly larger.
from docx import Document
from docx.shared import Inches
doc = Document('test.docx')
new_doc = Document()
sections = new_doc.sections
for section in sections:
section.left_margin = Inches(3)
section.right_margin = Inches(3)
for para in doc.paragraphs:
table = new_doc.add_table(rows=1, cols=1)
table.style = 'Table Grid'
cells = table.rows[0].cells
cells[0].text = para.text
new_doc.add_paragraph('\r')
new_doc.save('details.docx')