

Validate Office Open XML files in nodejs the browser
Install
npm install @ooxml-tools/validate --save
CLI
Once installed run
ooxml-validate ./test.docx
All the options can be seen with
ooxml-validate --help
Usage
Pass an ArrayBuffer as input and get results as output
import validate from "@ooxml-tools/validate";
const version = "Microsoft365";
const results = await validate(input, version);
console.log(results);
Where version of one of ["Microsoft365", "Office2007", "Office2010", "Office2013", "Office2016", "Office2019", "Office2021"]
Development
[!NOTE]
If you don't feel like installing all the dependencies you can run the following
./docker.sh
This will start a docker shell with all the dependencies installed. The following commands can then be run in that shell without installing any dependencies (other then docker/docker-compose)
You'll need dotnet 8 installed locally, to whether it's installed run dotnet --version.
You'll also need to install the node_modules via
npm install
Build the library run
npm run build
The built npm package will be output to ./dist/npm/*
ls -l ./dist/npm/
Known issues
It comes with some known issues
- The library is huge, and slow. It's currently base64 encoding the WASM because of the issues getting WASM building across bundlers (help wanted)
- The library base64 encodes the input OOXML file, which is slow. We should be using streaming (help wanted)
- The C# is probably very poor quality... I'm not a C# developer (help wanted)
Licence
MIT