Welcome to the Atlassian developer community @s1093,
I don’t know about the whole path to a custom MS Word template because there is a lot of work between the existing Jira REST APIs and MS Word format. On the MS Word side, maybe you need a library like docx.js?
That said, I was hoping you could clarify what you mean by “export”?
On one hand, if you want export by just making a downloadable file stream, then here’s what another developer was able to do:
On the other hand, if you want to export by sending the document somewhere, then you will need to be aware of the egress controls:
https://developer.atlassian.com/platform/forge/add-content-security-and-egress-controls/