Pretty sure you could do it via a Word COM add-in, I'm running a couple of such addins —
EPUB Tools and Transtools.
EPUB Tools was last released in Mar 2018, not only does it work on latest Office 365… it works better than it ever did. Function-wise, all the features I use work just like they always did, performance-wise: faster, smoother, less likely to wedge… in fact it's ages since it did.
BR