Quantcast
Channel: /r/powershell – How to Code .NET
Viewing all articles
Browse latest Browse all 8793

How can I edit Word documents without Office installed on the target machine?

$
0
0

I have a script to run our monthly maintenance checklist, and it returns a lovely HTML page. Manglement, of course, wants it in a specially formatted Word doc.

Since this is run on DCs at several clients, and none of said DCs have Office installed, I can’t do this using COM object magic, and I’m limited to Powershell 2.0 because it’s the lowest common denominator.

I’ve tried the unzip/edit document.xml/re-zip trick, but it seems to fail somewhere along the line because it’s extremely picky about how the unzipped directory is named. If I browse the zip files in 7-zip (while making the change manually), and copy in and out of that, it works fine. If I try to do it by unzipping to an actual directory, Word always complains about missing or invalid parts of the file.

Portability is a must, so PowerShell/batch is the only way to go here.

Has anybody been able to edit Word docs in PowerShell without Office being installed?

submitted by /u/twoscoopsofpig
[link] [comments]

The post How can I edit Word documents without Office installed on the target machine? appeared first on How to Code .NET.


Viewing all articles
Browse latest Browse all 8793

Trending Articles