Skip to content

Commit b43f40b

Browse files
author
Jason Ward
committed
refs #62: Added a simple entry point for docx2html
1 parent bda16f5 commit b43f40b

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

pydocx/parsers/Docx2Html.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import base64
2+
import sys
23
import xml.sax.saxutils
34

45
from pydocx.DocxParser import DocxParser
@@ -203,3 +204,18 @@ def indent(self, text, just='', firstLine='', left='', right=''):
203204

204205
def break_tag(self):
205206
return '<br />'
207+
208+
209+
def main():
210+
try:
211+
path_to_docx = sys.argv[1]
212+
path_to_html = sys.argv[2]
213+
except IndexError:
214+
print 'Must specific the file to convert and the name of the resulting file.' # noqa
215+
sys.exit()
216+
html = Docx2Html(path_to_docx).parsed
217+
with open(path_to_html, 'w') as f:
218+
f.write(html)
219+
220+
if __name__ == '__main__':
221+
main()

0 commit comments

Comments
 (0)