Kotlin library to create docx with template

What is the best way to create docx file with template? I was trying Apahe Poi or JavaScript Docxtenplater. The frst one not work on my project, second is very easy but not work on webvew.