Converting fields to plain text - available through the SDK API?

Since Libreoffice version 25.8 it it now possible to remove fields and replace them with plain text (Ctrl+Shift+F9). See also this bugzilla entry: 45946 – EDITING: Allow conversion of field codes (of fields like date, variable or mail merge) into plain text and the release notes for 25.8 (can’t link it due to 2 link limit…)

I was wondering whether this function is also available through the SDK API? If so, where can I find some documentation for it?

The reason for my request is that I am trying to improve the Zotero Libreoffice integration, where the lack of proper field code → plaintext conversion is a longstanding issue: Remove Fieldcode removes italics from footnotes · Issue #11 · zotero/zotero-libreoffice-integration · GitHub

The macro recorder hints at such a way (I haven’t tested it thoroughly).

' Converts the oField field of the oDoc document to text.
Sub ConvertFieldToText(Byval oDoc as Object, Byval oField as Object)
  Dim oDisp as Object
  oDisp = createUnoService("com.sun.star.frame.DispatchHelper")
  oDoc.CurrentController.Select oField.Anchor
  oDisp.executeDispatch(oDoc.CurrentController.Frame, ".uno:ConvertSelectedField", "", 0, Array())
 End Sub
 
 
 ' Convert all fields of the current document to text.
 Sub TestConvertFieldToText()
   Dim oDoc as Object
   oDoc = ThisComponent
   For Each oField In ThisComponent.TextFields
     ConvertFieldToText oDoc, oField
   Next oField
 End Sub
1 Like