2017-03-14 1 views
0
import pypandoc 
output = pypandoc.convert_file('file.html', 'docx',outputfile="file1.docx") 
assert output == "" 

新しいdocxファイルを生成していますが、スタイルは無視しています。どうすればhtmlをpythonでdocxに変換できますか?

スタイルで新しいdocxファイルを生成する方法を教えてください。

ご回答いただきありがとうございます。

+1

これを確認してくださいhttp://stackoverflow.com/questions/1035183/how-can-i-create-a-word-document-using-pythonとhttp://python-docx.readthedocs.io/en/latest /user/styles-using.html – Shailesh

答えて

1

Windowsでは、最も簡単な方法は、pywin32プラグインを使用してMS Wordを使用することです。サンプルコードでHere is good答えてください。

使用pypandoc:extra_argsため

output = pypandoc.convert(source='/path/to/file.html', format='html', to='docx', outputfile='/path/to/output.docx', extra_args=['-RTS']) 

読むthis

関連する問題