OpenDoc tool reloaded

In a previous post, I described a tool for editing OpenXML documents from a managed context.

I've added three more features for some common tasks:

 1. Remove a part

Syntax:

 OpenDoc.exe -r <Input file> <Part>

Sample usage scenarios: removing the calculation chain, removing unwanted resources, removing slides, worksheets.

 2. Remove all attributes

 Syntax:

OpenDoc.exe -t <Input file> <Part> <XPath> removeAttibutes

Sample usage scenarios: fixing corrupt elements.

 

The attached archive shows a sample usage: repairing an Excel workbook by:

  • removing the calcChain.xml part
  • removing the calcChain relationship
  • removing the shared formulas from cell entries

The batch looks like this: 

-t Corruptible.xlsm /xl/worksheets/sheet1.xml //n:sheetData/n:row/n:c/n:f[@t='shared'] removeAttributes
-r Corruptible.xlsm /xl/_rels/workbook.xml.rels //n:Relationship[@Target='calcChain.xml']
-r Corruptible.xlsm /xl/calcChain.xml

@Update 04/22/2010: Fixed but with long file names in batch mode

Test.zip