Welcome!
This is the community forum for my apps Pythonista and Editorial.
For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.
Create docx file using Python-docx?
-
I would like to convert an .md or .txt file to a docx, locally. I've been using the docverter workflow, and I'm really happy with it, but it still needs an internet connection, which is sometimes not possible.
I recently found Python-docx on github (https://github.com/python-openxml/python-docx) which seems to do exactly that.
I don't have a clue about working in Python. Is this something Editorial can do in a workflow with a python step?
Is Python-docx even possible to use on an iOS device?
If not, does anyone have any ideas about how to do the conversion?
FYI, all I'm really trying to do is send an Editorial file to Word (for iPad) using "open in". I can make Word appear as a sharesheet destination by just giving the file a .docx extension, but of course it won't open in Word.
Thanks for any advice.
-
I am pretty sure this isn't possible, since
python-docx
(andpython-xlsx
) requireslxml
, which is not installed on Pythonista or Editorial and is a C library rather than a native Python module and therefore can't be user-installed. It would require either a) Ole to includelxml
as part of the app, or b) someone to reworkpython-docx
and-xlsx
to use another XML-parsing module, like sayelementtree
.I would dearly love to be proven wrong, though.
-
The app makeDoc by toketaWare
https://appsto.re/gb/6bHsK.iCan use x-callbacks and will create docx files from markup and text.
-
@roosterboy197 I have had some success in the past simply replacing
lxml
functions with theirxml
equivalents (only works in some places). I remember getting one module to work by replacingimport lxml.etree
with
import xml.etree
sucessfully. I don't know how heavily
lxml
is used, but in some cases,xml
can be used to do the same operations slightly less efficiently.