Can you trigger libreoffice to send a request to save the document via code?

Hey guys,

Save as does not save the file data, it just moves the file. I wanted to ask you guys if there is a way to tell LibreOffice to save the file? (Besides clicking the save button of course).

The Problem basically is, whenever I use save as, the file gets moved, but the concent is not saved since I dont allow “exitOnSave”, so I’d have to manually click save after save as. Are there better ways to solve this?

Or did I not implement/understand save as correctly?

//EDIT: I guess the PostMessageAPI can be used to achieve what im asking (?)

Best regards