harshankur / officeParser

A Node.js library to parse text out of any office file. Currently supports docx, pptx, xlsx and odt, odp, ods..
MIT License
123 stars 17 forks source link

Numbered elements aren't preserved as they show up in .docx files #29

Open ultran1te opened 5 months ago

ultran1te commented 5 months ago

I'm currently trying to create a method of parsing .pdf, .docx, and other files containing questions and converting it to a format that can imported to an online learning platform. I'm having a problem in the situation shown below where .docx files use the built in numbered list formatting and the numbers are lost.

image

The above image results in: 34.How do you... What is.. What is a... 36.Water... a. option a b. option b c. option c d. option d

I'm unsure if this is something wrong with the docx file or the library. I've tested this without doing anything to the data that officerParser outputs and it has the same results. I've done a bit of digging into this and it seems that the only preserved numbers are those that are misformatted in the .docx file. If they do correctly use the built-in numbering system, they will be removed. Otherwise, they are preserved. Not necessarily a problem, just makes it difficult to parse the questions.

harshankur commented 5 months ago

Hi @ultran1te, I would need to have a look at the document file. Can you create a copy of the document, remove all the other content that is not visible in the attached image and share it here?

ultran1te commented 5 months ago

Hi @ultran1te, I would need to have a look at the document file. Can you create a copy of the document, remove all the other content that is not visible in the attached image and share it here?

Here is the document with everything else removed. I verified that it does still occur with this document. Example Document.docx

Thank you for the quick response.