Powershell – using Open XML PowerTools Module

Well Microsoft has released some Tools and Frameworks for Open Techechnologies.

Building bridges between Microsoft and non-Microsoft technologies.
Powering interoperability through open standards and open source.

One of them is PowerTools for Open XML

Open XML is used by MS Office 2007 and upwards.

Have you ever wanted to create or manage MS Office Documents, without having Office installed.

Well here we go :

1. First download the PowerTools for Open XML

Go for the version 3.1.0x or higher

2. Extract the files somerwhere, and install the PS Module.

3. Create a new Module Folder called “OxPt”

%USERPROFILE%\Documents\WindowsPowerShell\Modules\OxPt

4. Copy these folders and files over there :

image

5. Next download and install the Install the OpenXML SDK 2.5

6. Next Open the PS IDE and run a Test like this :

CLS

import-module OxPt

New-Docx C:\test.docx -comment

As you can see there are many switches you apply

image

You will get a test document created with a comment in it.

This format is also compatible with the older version like MS Office 2007.

image

If you get this error :

New-Object : Cannot find type [System.Collections.Generic.List[OpenXmlPowerTools.Source]]: make sure the assembly containing this type is loaded.

image

Then you should move over to PS x64 instead of x32 !

Available Cmdlets :

image

Check it out Smile

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: