Factorise a bit the codebase

There is a some duplicate code in docx and odt processing. It would be nice to factorise this.