How to use MailMerge in Libreoffice Writer in the Visual Basic code?

Hi We have Visual Basic application . we use Mail merge feature from MS Word. From the application it opens the mail merge template and creates a word document for it with all the data filled in. We are moving to Libre Writer and need to know how do we do the same functionality with Libre Writer. which API to use? which functions to use?

I have the same problem!