I don't think client side manipulation is an option as the result needs to be made available directly via a web-based SaaS.
The licensing issue seems thorny. If this were as easy to set up and use as the comment I quoted suggested, we would need to get some validation that any end user performing "exports" had their own valid license to Word at the time of export.
I'm not sure what the secret sauce is in the third party libraries is that can't be done at a much more limited scope by manipulating the docx directly.
The most complex thing seems to be the determination of page numbers associated with various headings and the ability to refresh this on the fly.