<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p>Thanks <br>
    </p>
    <p>Ok  it seem a goot way</p>
    <p>maybe it is obvious but how can i paste the clipboard in my odt
      without using dispatch</p>
    <p><br>
    </p>
    <p><br>
    </p>
    <div class="moz-cite-prefix">Le 26/03/2023 à 21:20, Caolán McNamara
      a écrit :<br>
    </div>
    <blockquote type="cite"
      cite="mid:a981acfaca1ab71eeafc333bff9d42208236a291.camel@redhat.com">
      <pre class="moz-quote-pre" wrap="">On Sun, 2023-03-26 at 12:06 +0200, Zorg wrote:
</pre>
      <blockquote type="cite">
        <pre class="moz-quote-pre" wrap="">... We have try using XTransferable but without any success.
</pre>
      </blockquote>
      <pre class="moz-quote-pre" wrap="">
I think it should be possible in headless mode to use the clipboard
apis to copy and paste within LibreOffice. But in this case the
clipboard is basically a fake clipboard only for the headless
libreoffice instance, one which doesn't interact with any real system
clipboard.

So for example in your current code I see that copy_with_format copies
into a true X clipboard via xclip so in headless more we can't paste
from there and it has to be non headless to get that to work.

But if the LibreOffice apis to put something into the clipboard are
used then I think it should work to "Paste" within LibreOffice and get
that content back out, even in headless more. 

f.e. in this example at
<a class="moz-txt-link-freetext" href="https://ask.libreoffice.org/t/is-there-any-way-to-copy-calc-cell-content-and-paste-something-else/32173/11">https://ask.libreoffice.org/t/is-there-any-way-to-copy-calc-cell-content-and-paste-something-else/32173/11</a>
there is:

oClip =
ctx.getServiceManager().createInstanceWithContext("com.sun.star.datatra
nsfer.clipboard.SystemClipboard", ctx)
oClip.setContents(transferable, None)

where "transferable" is implemented in that example as something that
only supports "text/plain;charset=utf-16" so if you change
copy_with_format to something that follow the model of the above
example implementation of an XTransferable to set a transferable that
provides the data and its mimetype as text/html I would expect it to
work.

</pre>
    </blockquote>
    <div id="grammalecte_menu_main_button_shadow_host" style="width:
      0px; height: 0px;"></div>
  </body>
</html>