0

Is there any good library that can help to parse a .docx file in a serial manner?

I am in search of a library that can allow me to parse a docx file in following fashion:

d = open("input.docx","rb")
parsed = library.parse(d, output="json")
print(parsed)

and I expect output as:

[
   {
      "type":"page",
      "children":[
         {
            "type":"header",
            "children":[
               {
                  "type":"line",
                  "children":[
                     {
                        "text":"",
                        "fontSize":11
                     }
                  ]
               }
            ]
         },
         {
            "type":"content",
            "active":true,
            "children":[
               {
                  "type":"line",
                  "children":[
                     {
                        "text":"",
                        "fontSize":11
                     }
                  ]
               }
            ]
         },
         {
            "type":"footer",
            "children":[
               {
                  "type":"line",
                  "children":[
                     {
                        "text":"",
                        "fontSize":11
                     }
                  ]
               }
            ]
         }
      ],
      "marginTop":1,
      "marginLeft":1,
      "marginRight":1,
      "orientation":"portrait",
      "marginBottom":1
   }
]

python and javascript are preferred as these are the popular languages.

0
0

Here are some libraries for python that you can use:

  1. https://github.com/Untether-Tech/Simplify-Docx/
  2. https://github.com/jdthorpe/python-docx/
  3. https://github.com/CenterForOpenScience/pydocx/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.