2

I am trying to convert my HTML file to docx using pypandoc library of python. But while converting HTML file to docx the numbered list is not preserving in docx file.

Numbered List in HTML File:

enter image description here

Numbered List in docx file:

enter image description here

Here is my code:

import pypandoc
pypandoc.convert('Outline.html', 'docx', outputfile='Outline.docx')

Also tried using:

pypandoc.convert_file('Outline.html', 'docx', outputfile='Outline.docx')

I am using the following environment:

pypandoc 1.4  # Installed using pip
pandoc 1.12.2.1
OS : Ubuntu 14.04
Python Version : Python 2.7

I tried using following versions of libraries also:

pypandoc 1.3
pandoc 2.0
pandoc 2.4
pandoc 2.5

Please refer the attached files for more clarification:

HTML file : Outline.html

Generated Docx file : Outline.docx

Does anyone have any suggestions for converting HTML file to docx file with numbered list preserved using pypandoc ?

Thank you.

Community
  • 1
  • 1
Bharat Jogdand
  • 438
  • 3
  • 16
  • 1
    The software versions are ancient, this is likely to be fixed by updating. Please insert the relevant HTML snippets into the question instead of linking to a file on a third party server. – tarleb Dec 03 '18 at 15:22
  • I am using latest `pypandoc` version and also tried with different versions of `pypandoc` and `pandoc`. And HTML file contents are too big that's why I preferred to link the file url. – Bharat Jogdand Dec 03 '18 at 15:43
  • 1
    If you tried different versions, then please add this information to your question. Pandoc 1.12.2.1 was released almost exactly 5 years ago. The fact that the file is too large was part of my point, which I admittedly should have made clearer. It is difficult to help if one has to first pin-point the relevant HTML code. A question is more likely to be answered if it doesn't require a lot of work on the side of people trying to help you. – tarleb Dec 03 '18 at 15:55
  • Hi @tarleb, Thanks for suggestions. I have updated question according to your suggestions. The issue is not reproducible if I remove some of data from HTML file, So I couldn't make it smaller and post in question. – Bharat Jogdand Dec 03 '18 at 19:57

0 Answers0