From f8f8ac61afe9017b44a482fbe9281b7f4080ca3b Mon Sep 17 00:00:00 2001 From: navanchauhan Date: Thu, 1 Jun 2023 10:19:07 -0600 Subject: change template --- assets/doc_template.docx | Bin 62767 -> 61783 bytes main.py | 15 ++++++--------- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/assets/doc_template.docx b/assets/doc_template.docx index 3538a9d..233f30c 100644 Binary files a/assets/doc_template.docx and b/assets/doc_template.docx differ diff --git a/main.py b/main.py index 69f2277..30505a5 100644 --- a/main.py +++ b/main.py @@ -217,17 +217,14 @@ class CompanySelector: document = Document("assets/doc_template.docx") - advisor = self.advisor_string.get() + advisor = self.prepared_for_string.get() today = datetime.today() - document.paragraphs[0].text = document.paragraphs[0].text.replace("{{ADVISOR}}", advisor) + to_replace = document.paragraphs[1].text + to_replace = to_replace.replace("{{ADVISOR}}", advisor) + to_replace = to_replace.replace("{{DATE}}" , today.strftime("%B %m, %Y")) - to_replace = document.paragraphs[3].text - - to_replace = to_replace.replace("{{MONTH}}" , today.strftime("%B")) - to_replace = to_replace.replace("{{YEAR}}" , today.strftime("%Y")) - - document.paragraphs[3].text = to_replace + document.paragraphs[1].text = to_replace for company, ticker, dividend, currency, desc in zip(selected_df["Company Name"], selected_df["Symbol"], selected_df["Dividend?"], selected_df["Currency"], selected_df["Blurb"]): extra_char = "" @@ -240,7 +237,7 @@ class CompanySelector: new_paragraph.alignment = WD_ALIGN_PARAGRAPH.LEFT document.paragraphs.pop() desc_paragraph = document.add_paragraph(f"\n{desc}\n") - desc_paragraph.alignment = WD_ALIGN_PARAGRAPH.JUSTIFY + desc_paragraph.alignment = WD_ALIGN_PARAGRAPH.LEFT desc_paragraph.bold = False document.save(word_file_path) -- cgit v1.2.3