I am looking for a Synchronous API equivalent for executeDispatch(.uno:UpdateAll).

Context:

I produce ODT documents by running an Emacs Org-mode document (a plaintext markup format like Markdown). The document so produced is then passed through a Basic Macro via a command line. This macro does exactly what Tools->Update->Update All does. Passing the document through a macro ensures that (pagenos in) TOC of the ODT document is up to date.

When working with large documents, the above "UpdateAll" fails. This is probably because the macro's Subroutine exits even before the executeDispatch has finished its work. I have read through the forums, and one of the suggested workarounds for this problem is to add a wait after a dispatch. I am not comfortable with this workaround, I would prefer a macro (Basic, Python or Java whatever) that would __guarantee__ me that the fields are up to date before the shell command exits.

So, Can someone help me with Synchronous API equivalent for executeDispatch(.uno:UpdateAll).

doc.updateAll() updates all external links but I'm not sure if this is the only thing you want to update because the user interface command updates all links, fields, indexes, tables of contents, and page formatting in the current document. I'm not familiar with Writer and finding adequate API methods is a nightmare even though I'm very familiar with my object inspector and the general concepts of this API.

Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.Ubuntu 18.04, OpenOffice 4.x & LibreOffice 6.x

Villeroy wrote:doc.updateAll() updates all external links but I'm not sure if this is the only thing you want to update because the user interface command updates all links, fields, indexes, tables of contents, and page formatting in the current document.