help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: get text from LibreOffice Calc to Emacs Org-Mode


From: Gottfried
Subject: Re: get text from LibreOffice Calc to Emacs Org-Mode
Date: Mon, 24 Apr 2023 08:24:31 +0000

Hi,

thanks for help.

I tried with "quote".

It gets the same result, as if I simply copy the text from LibreOffice calc to Emacs.org-mode

May be there is no other solution.
-----------------------------------------------------------------------
1. Use some external script to transfer clipboard contents from Calc format into Org-table format. So you C-c in Calc to copy the table, invoke external script to transform the clipboard, then paste the contents into Emacs. Personally I'd prefer Python, but you can use whatever you are comfortable with;

this seems to be too difficult for me.
--------------------------------------------------------------------

2. Get clipboard contents and perform transformation directly in Emacs. So you 
C-c in Calc, then call M-x paste-from-libreoffice-calc in Emacs. The code will 
be something like this:

(defun paste-from-libreoffice-calc ()
  (interactive)
  (let* ((selection (gui-get-selection 'CLIPBOARD (intern 
"application/x-libreoffice-tsvc")))
         (tsvc ...) ;; decode from UTF-16
         (result ...)) ;; parse tsvc, format it into an Org-table
(insert result)))

I don’t know if that possibility would make a difference to simply copy the text. Is sees to me also difficult to use, because I don’t know emacs so much yet. I am learning.
AFAIU I would have to copy this part into my init.el file
--------------------------------------------------------------------------------
Kind regards

Gottfried



Am 24.04.23 um 09:35 schrieb Platon Pronko:
Why not just use quote? :)

Wasn't immediately sure that would work :) But obviously that's better, thank you!

Alternatively, you may find `org-table-import' useful.  I believe Calc
can export to simple formats like CSV or TSV, and you may be able to use
this function to convert into a table.

I tested it - it is unable to process multiline cells correctly.
And I suspect that was one of the main problems Gottfried was facing.


--

Attachment: OpenPGP_0x61FAF349C9FB7F94.asc
Description: OpenPGP public key

Attachment: OpenPGP_signature
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]