If not, is there a way to do that with either docx4j or Aspose?
I've stumbled across the question
docx Template Docx4j replacing text in Java. It describes the actual problem I'm facing, which are template variables (like ${some.variable}
) breaking across text runs due to spell check. However, his solution won't work well for me. The best solution I could achieve would be to disable (and maybe re-enable) spell check automatically under the hood.