diff options
author | navanchauhan <navanchauhan@gmail.com> | 2023-06-01 10:19:07 -0600 |
---|---|---|
committer | navanchauhan <navanchauhan@gmail.com> | 2023-06-01 10:19:07 -0600 |
commit | f8f8ac61afe9017b44a482fbe9281b7f4080ca3b (patch) | |
tree | 8bdec4515840d1192f672535e8df84d8f443aec8 | |
parent | ad4561d3c5b93a0f2bd9f66760f97ac0c6068d20 (diff) |
change template
-rw-r--r-- | assets/doc_template.docx | bin | 62767 -> 61783 bytes | |||
-rw-r--r-- | main.py | 15 |
2 files changed, 6 insertions, 9 deletions
diff --git a/assets/doc_template.docx b/assets/doc_template.docx Binary files differindex 3538a9d..233f30c 100644 --- a/assets/doc_template.docx +++ b/assets/doc_template.docx @@ -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) |