Open robo3945 opened 7 years ago
Load into word. "save as" close issue
@robo3945 This library is for handling docx documents/files. If you need to create documents in text format (.txt) there are better ways.
I do not want to create text file, I'd like to extract the plain text from a docx. And I'd like to do via API not using Word ;)
@robo3945 I see, you can make a loop that traverses the Document's paragraph and extracts their text-value.
Code in its simplest form below:
document = Document('test.docx')
txt_arr = []
for p in document.paragraphs:
txt_arr.append(p.text)
# TODO: save the contents of txt_arr to a .txt file
it's passed a lot of time from this answer and I do not remember well, but your code works also for lists in the DOCS?
Does it work for bullet list too?
@robo3945 I see, you can make a loop that traverses the Document's paragraph and extracts their text-value.
Code in its simplest form below:
document = Document('test.docx') txt_arr = [] for p in document.paragraphs: txt_arr.append(p.text) # TODO: save the contents of txt_arr to a .txt file
Note that this won't work with bullets: the numbering won't be exported! This made me switching over to pypandoc.
HI everybody,
How to convert the DOCX file in TXT? Some export functions will be useful?
I use that git project but it's not reliable...
Thanks