Untitled
unknown
plain_text
2 years ago
2.1 kB
7
Indexable
from docx import Document
from docx.shared import Pt
from docx.oxml.ns import qn
from docx.oxml import OxmlElement
# Create a new Document
doc = Document()
# Add a title to the document
doc.add_heading('Four-Day Study Schedule', 0)
# Define the schedule data
schedule = [
["Time", "Day 1", "Day 2", "Day 3", "Day 4"],
["8:00 - 9:30", "-", "Topic 6", "Topic 13", "Review Topics 7-12"],
["9:30 - 10:00", "-", "Break", "Break", "Break"],
["10:00 - 11:30", "-", "Topic 7", "Topic 14", "Review Topics 13-18"],
["11:30 - 12:00", "-", "Break", "Break", "Break"],
["12:00 - 13:30", "-", "Topic 8", "Topic 15", "Additional Review/Weak Areas"],
["13:30 - 14:30", "-", "Lunch Break", "Lunch Break", "Lunch Break"],
["14:30 - 16:00", "Topic 1", "Topic 9", "Topic 16", "Practice Questions/Mock Tests"],
["16:00 - 16:30", "Break", "Break", "Break", "Break"],
["16:30 - 18:00", "Topic 2", "Topic 10", "Topic 17", "Practice Questions/Mock Tests"],
["18:00 - 18:30", "Break", "Break", "Break", "Break"],
["18:30 - 20:00", "Topic 3", "Topic 11", "Topic 18", "Final Review and Notes"],
["20:00 - 21:00", "Dinner", "Dinner", "Dinner", "Dinner"],
["21:00 - 22:30", "Topic 4", "Topic 12", "Review Topics 1-6", "Relax and light review"],
["22:30 - 23:00", "Break", "Break", "Break", "Break"],
["23:00 - 00:00", "Topic 5", "Relax and unwind", "Relax and unwind", "Relax and unwind"]
]
# Add table to the document
table = doc.add_table(rows=1, cols=len(schedule[0]))
table.style = 'Table Grid'
# Add header row
hdr_cells = table.rows[0].cells
for i, cell in enumerate(hdr_cells):
hdr_cells[i].text = schedule[0][i]
# Add the rest of the data
for row in schedule[1:]:
row_cells = table.add_row().cells
for i, cell in enumerate(row):
row_cells[i].text = cell
# Adjust font size for better readability
for row in table.rows:
for cell in row.cells:
for paragraph in cell.paragraphs:
for run in paragraph.runs:
run.font.size = Pt(10)
# Save the document
file_path = "/mnt/data/Study_Schedule.docx"
doc.save(file_path)
file_path
Editor is loading...
Leave a Comment