次の方法で共有


PowerTools

PowerTools for Open XML

Processing Open XML documents using PowerShell on a server is a powerful and compelling approach to creation and modification of Open XML documents.

This blog is inactive.
New blog: EricWhite.com/blog

Blog TOCPowerTools for Open XML are sample source code and guidance for developers showing how to build PowerShell cmdlets to create and modify Office Open XML documents, and scripts to demonstrate the use of the cmdlets.

To download the PowerTools for Open XML: www.CodePlex.com/PowerTools

To install and use the PowerTools for Open XML:

  • You need to have any edition (including Express Edition) of Visual Studio 2008 installed. Download the Express Edition.
  • You need to have PowerShell installed. Download.
  • PowerTools is built on the Open XML SDK. Download.

More Resources 

Screen-cast that shows how to download, build, and use the PowerTools.

PowerTools for Open XML Technical Overview (For C# developers who want to enhance or modify the PowerTools cmdlets).

Example Scripts for the PowerTools.

List of PowerTools: 

Set-OpenXmlCustomXmlData

The Set-OpenXmlCustomXmlData cmdlet sets or replaces the specified custom XML part in the document.

Remove-OpenXmlComment

The Remove-OpenXmlComment cmdlet locates and removes comment contents and references from Wordprocessing documents.

Add-OpenXmlDocumentTOC

The Add-OpenXmlDocumentTOC cmdlet creates a Table of Contents based on the headings found it in the document. The TOC will be created at the end of the document.

Add-OpenXmlDocumentIndex

The Add-OpenXmlDocumentIndex cmdlet creates an index based on the index references found in the document. The index will be created at the end of the document.

Set-OpenXmlWatermark

The Set-OpenXmlWatermark cmdlet adds watermark text to the background of a document. iI the DiagonalOrientation parameter is specified, then the text will be in a diagonal orientation rather than horizontal.

Add-OpenXmlPicture

The Add-OpenXmlPicture cmdlet inserts a picture at a specific location inside an OpenXML document. The picture will be stored inside the document as an embedded resource. Picture location is specified by an XPath query expression.

Set-OpenXmlHeader

The Set-OpenXmlHeader cmdlet inserts header parts into all sections of a Wordprocessing document.

Lock-OpenXmlDocument

The Lock-OpenXmlDocument cmdlet sets a lock inside one or more Wordprocessing documents to prevent them from being edited.

Get-OpenXmlStyle

The Get-OpenXmlStyle cmdlet retrieves the styles definition part from a WordprocessingML or SpreadsheetML document and returns an XDocument object containing the styles content.

Get-OpenXmlTheme

The Get-OpenXmlTheme cmdlet extracts the whole theme part from a Wordprocessing document as a thmx file (with media resources embedded). A Package object (System.IO.Packaging.Package) is returned that corresponds to the theme file.

Accept-OpenXmlChange

The Accept-OpenXmlTextChange cmdlet processes documents with text revisions (change tracking elements), by accepting all the text changes performed on the document.

Set-OpenXmlBackground

The Set-OpenXmlBackground cmdlet changes the background image or background color of a Wordprocessing document.

Get-OpenXmlComment

The Get-OpenXmlComment extracts all the comments from a document, and return all of them in a XDocument

Add-OpenXmlDigitalSignature

The Add-OpenXmlDigitalSignature cmdlet uses a digital certificate to digitally sign a Wordprocessing document.

Get-OpenXmlDocument

The Get-OpenXmlDocument cmdlet returns an OpenXML document object for each document file. The actual object will depend on the type of document in the file. For example, if it is a spreadsheet, the object will be a SpreadsheetDocument, which is derived from OpenXMLDocument.

Get-OpenXmlCustomXmlData

The Get-OpenXmlCustomXmlData cmdlet gets the first custom Xml part that matches the given name and returns it as an XDocument object.

Export-OpenXmlToHtml

The Export-OpenXmlToHtml cmdlet transforms the content of Wordprocessing documents into an html file by applying an XSLT transformation over the main content and extracting images from the package to a given location.

Add-OpenXmlDocumentTOA

The Add-OpenXmlDocumentTOA cmdlet creates a Table of Authorities based on the citations (references or authorities) found it in the document. The TOA will be created at the end of the document.

Set-OpenXmlStyle

The Set-OpenXmlStyle cmdlet replaces the style library in a WordprocessingML or SpreadsheetML document.

Get-OpenXmlFooter

The Get-OpenXmlFooter cmdlet retrieves all the specified footer parts from a document and returns an XDocument array of those footers. An object is returned for the specified footer in each Section of the document.

Get-OpenXmlDigitalSignature

The Get-OpenXmlDigitalSignature cmdlet returns a summary of digital signatures present in the Wordprocessing document

Set-OpenXmlTheme

The Set-OpenXmlTheme cmdlet sets the current theme in a Wordprocessing document to the specified theme.

Remove-OpenXmlDigitalSignature

The Remove-OpenXmlDigitalSignature cmdlet removes digital signatures from a Wordprocessing document

Add-OpenXmlContent

The Add-OpenXmlContent cmdlet injects custom xml markup inside a given part from a Wordprocessing document

Export-OpenXmlWordprocessing

The Export-OpenXmlWordprocessing uses plain text to create a Wordprocessing document.

Set-OpenXmlContentFormat

The Set-OpenXmlContentFormat cmdlet inserts markup containing format to be applied on a given run or paragraph. Format location is specified as an xpath query.

Set-OpenXmlFooter

The Set-OpenXmlFooter cmdlet inserts footer parts into all sections of a Wordprocessing document.

Get-OpenXmlWatermark

The Get-OpenXmlWatermark cmdlet retrieves the text of the document's watermark.

Get-OpenXmlBackground

The Get-OpenXmlBackground cmdlet extracts the background (color or image) from a document according to the parameters Image or Color.

Export-OpenXmlSpreadsheet

The Export-OpenXmlSpreadsheet gets the public properties from any objects and generates a spreadsheet with columns showing for each property. Optionally, a chart can be created from a subset of those properties.

Set-OpenXmlContentStyle

The Set-OpenXmlContentStyle cmdlet inserts inserts markup containing the style format to be applied on a given run or paragraph. Format location is specified as an xpath query.

Add-OpenXmlDocumentTOF

The Add-OpenXmlDocumentTOF cmdlet creates a Table of Figures based on the figures found it in the document. The TOF will be created at the end of the document.

Get-OpenXmlHeader

The Get-OpenXmlHeader retrieves all the existing header parts from a document. The execution returns an XDocument array of all the header parts found in the document.

Open XML Power Tools.zip

Comments

  • Anonymous
    April 05, 2010
    Do you plan to use it with sdk 2?