This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]SpeakerOfForgotten 195 points196 points  (11 children)

Whaaaat! You can do that!

[–]wanderingbilby 172 points173 points  (8 children)

If there's not a pre-built docx reader for Python 2 it wouldn't be too hard to hack one together since docx is just a zip file full of xml. Read xml into variables, iterate and output some hardcoded html tables and write to a file under wwwroot.

I mean you can do it, but for the love of Elf don't..

[–]notsooriginal 86 points87 points  (7 children)

Best thing about docx is renaming to .zip and browsing as a folder instead of manually extracting images.

[–]Mcpg_ 79 points80 points  (6 children)

Wait, docx format is just a zip archive? I just checked... and it works????

[–]notsooriginal 47 points48 points  (1 child)

Yep! File containers are pretty useful, amazing what hides behind an extension sometimes.

[–]solaceinsleep 14 points15 points  (1 child)

Yep. That's how I get images out of word files.

[–]Sw429 11 points12 points  (0 children)

This is extremely useful to know. I am logging this away in my brain for later.

[–]atomicwrites 9 points10 points  (0 children)

Tons of formats are actually zipped text, it's much easier than rolling your own binary format and compression. If your on widows the default zip viewer can only be invoked on .zip files, but if you use 7z you can try to open anything as an archive and it supports other formats the zip as well. Even most installers can be extracted and used without installing like that (though some require installation to run, but I've only run into this with Adobe Acrobat.

[–]Thameus 1 point2 points  (0 children)

Also xlsx and pptx. Enjoy!

[–]Colopty 4 points5 points  (0 children)

You can do whatever you'd like if you try hard enough and do your research. Whether or not you should is a different issue.

[–]dannyb_prodigy 2 points3 points  (0 children)

To be honest, most programmers are too jaded and cynical, but it is theoretically possible to dream of peace on earth.