<html>I have no idea if this will be of any use to you or not, but...<br /><br />I do not generally use the API using Python so I cannot comment on using Python. <br /><br />I have also not used headless mode so I cannot comment on what is and is not available other than knowing that dispatches are not available. <br /><br />Finally, I have done almost nothing using the clipboard, but... <br /><br />First note that the clipboard should have content of different varieties. I assume that you are aware of this because you have a line as follows: <br /><br /> copy_with_format(value, 'text/html')<br /> <br /> And if I look at the clipboard I see this as an available type<br /> <br />   Dim sClipName As String<br />  Dim oClip As Object<br />  Dim oFlavors As Variant<br />  Dim oFlavor As Variant<br />  Dim i as Integer<br />  Dim s as String<br />  <br />  sClipName = "com.sun.star.datatransfer.clipboard.SystemClipboard"<br />  oClip = createUnoService(sClipName)<br />  oFlavors = oClip.getContents().getTransferDataFlavors()<br />  s = ""<br />  For i = LBound(oFlavors) To UBound(oFlavors)<br />    oFlavor = oFlavors(i)<br />    s = s & i & " : " & oFlavor.MimeType<br />    s = s & CHR$(10)<br />  Next<br />  MsgBox s<br />  <br />  <br />  I see that method defined in this code here: <br />  <br />  https://github.com/Probesys/lotemplate/blob/html_formatting/lotemplate/utils.py<br />  <br />  I see that you open a pipe. <br />  <br />  I did some experiments and I am extracting the actual HTML. I assume that this is not really what you want, but this is how I extract it and display it. I was simply playing around with it out of curiousity.<br />  <br />    Dim sClipName As String<br />  Dim oClip As Object<br />  Dim oFlavors As Variant<br />  Dim oFlavor As Variant<br />  Dim i as Integer<br />  Dim idx as Integer<br />  Dim s as String<br />  <br />  sClipName = "com.sun.star.datatransfer.clipboard.SystemClipboard"<br />  oClip = createUnoService(sClipName)<br />  oFlavors = oClip.getContents().getTransferDataFlavors()<br />  s = ""<br />  idx = -1<br />  For i = LBound(oFlavors) To UBound(oFlavors)<br />    oFlavor = oFlavors(i)<br />    s = s & i & " : " & oFlavor.MimeType<br />    If oFlavor.MimeType = "text/html" Then<br />      idx = i<br />    End If<br />    s = s & CHR$(10)<br />  Next<br />  'MsgBox s<br />  <br />  If idx < 0 Then<br />    Print "text/html mime type not found"<br />    Exit Sub<br />   End If<br />  <br />  ' Now print the actual HMTL as a string!<br />  Dim oData As Variant<br />  oData = oClip.getContents().getTransferData(oFlavors(idx))<br />  s = ""<br />  For i = LBound(oData) To UBound(oData)<br />    s = s & CHR$(oData(i))<br />  Next<br />  MsgBox s<br /><br />If I kept going, then I would attempt to then use the transferable content directly, which is obtained from oClip.getContents() I believe. But, one of the real questions is.... Does the clipboard have the contents shown in the correct format? I assume it does. <br /><br />So, perhaps this helps a little anyway. <br /><br />Andrew Pitonyak<br /><br /><br />On Sunday, March 26, 2023 06:06 EDT, Zorg <zorg@probesys.com> wrote:<br /> <blockquote type="cite" cite="84dd1813-7ecc-4191-83e9-fc8ff6248173@probesys.com"> </blockquote><meta http-equiv="content-type" content="text/html; "><p>Hello</p><p>Hope some can help me here</p><p>Here is my  problem</p><p><br />We are developing our software using the uno api python</p><p>We re trying to to copy a string formatted in html in a libreoffice odt</p><p>We manage to do it but using dispatcher<br />The problem is that dispatcher not working in headless mode so il force us to use a xserver (xvfb) et Xclip.</p><p>It work but it's far from being optimized.</p><p>here is the code <a class="moz-txt-link-freetext" href="https://github.com/Probesys/lotemplate/blob/html_formatting/lotemplate/classes.py">https://github.com/Probesys/lotemplate/blob/html_formatting/lotemplate/classes.py</a> line 349-355</p><p>We have try using XTransferable but without any success.</p><p>Thanks in advance for your help</p><p>Sorg</p><div id="grammalecte_menu_main_button_shadow_host" style="width:
      0px; height: 0px;"> </div><div id="grammalecte_gc_panel_shadow_host" style="width: 0px;
      height: 0px;"> </div><div id="grammalecte_message_box_shadow" style="width: 0px; height:
      0px;"> </div><br /><br /> </html>