[Print and speak out a ms_word docx file as specified in the path]
()
| 9 | |
| 10 | |
| 11 | def ms_word(): |
| 12 | """[Print and speak out a ms_word docx file as specified in the path]""" |
| 13 | # TODO : Take location input from the user |
| 14 | try: |
| 15 | speak("Enter the document's location - ") |
| 16 | location = input("Enter the document's location - ") |
| 17 | |
| 18 | file_loc = doubleslash(location) |
| 19 | |
| 20 | doc = docx.Document(file_loc) |
| 21 | fullText = [] |
| 22 | for para in doc.paragraphs: |
| 23 | fullText.append(para.text) |
| 24 | # print(fullText) |
| 25 | doc_file = "\n".join(fullText) |
| 26 | print(doc_file) |
| 27 | speak(doc_file) |
| 28 | except Exception as exp: |
| 29 | # print(exp) |
| 30 | print(f"ERROR - {exp}") |
| 31 | print( |
| 32 | Fore.YELLOW |
| 33 | + "I could'nt locate the file!\nIf you didn't specify the extension of the file, please specify it." |
| 34 | ) |
| 35 | return "None" |
| 36 | |
| 37 | |
| 38 | def pdf_read(): |
no test coverage detected