DocXReducer is a library for reducing size of Word documents (.docx) by simplifying theirs XML. Consider using it for archived documents, because after reducing some Word functions may not work correctly
Test on XMLFileFormatsGuide.docx shows 15% size decreasing
This library uses only DocumentFormat.OpenXml
Install package DocxReducer with the Nuget package manager or the CLI
dotnet add package DocxReducer
Then with the class
var reducer = new Reducer();it's possible to process a document by path
reducer.Reduce(@".\Document.docx");or with a WordprocessingDocument class
var docx = WordprocessingDocument.Open(@".\Document.docx", true);
reducer.Reduce(docx);To build console app enter:
dotnet publish -c Release -r ridwhere rid is Runtime Identifier of target system. Possible values are:
- Windows:
win-x64 - Linux:
linux-x64 - MacOS:
osx-x64
Full list of rids can be found here