Numbered list is not preserved while converting html file to docx file using pypandoc

时间:2018-12-03 13:21:09

标签: python html python-2.7 pandoc pypandoc

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.

0 个答案:

没有答案