Using docx package in an IronPython script in Grasshopper

Hello,

has anybody had success importing docx into an IronPython script within Grasshopper? I know this question has been on here in the past, but maybe there is some updated info?

If so, how did you get it to work?

My goal is to generate simple, single page calculation reports based on a python script within GH and to automatically output the data into a formatted MS Word file.

Thanks in advance!

Brad

The PyPi docx package uses lxml, which has a lot of Cython code, so it won’t be easy (if it’s posisble at all) to run that in IronPython.

Docx is a MS format. IronPython originated at MS too. Have you tried: GitHub - xceedsoftware/DocX: Fast and easy to use .NET library that creates or modifies Microsoft Word files without installing Word. ?

Hi James,
Thanks for response. Where can one find a list of the available functions and methods for Word?
Is it still possible to format the text and create tables for example?

Hi Brad. I just found that here,

but then couldn’t actually add the reference. But if you want to perserver, I would look here:

It’s a bit of a hack, but docx files are just zipped xml files. IronPython still has plenty of xml tools.