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: Platon Pronko
Subject: Re: get text from LibreOffice Calc to Emacs Org-Mode
Date: Mon, 24 Apr 2023 13:46:41 +0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.9.1

On 2023-04-23 21:22, Gottfried wrote:
Hi,

yes, wonderful, you understood me.

Sorry, for not explaining it more correctly.

Because I have much text in each cell,
colums a and column b,
each with much text,
and underneath the same,
and so on...

I can’t create such a nice diagramm like this in emacs yet,
so I couldn’ explain it graphically.

   |---------+---------|
 > | column1 | column2 |
 > | alpha   |       1 |
 > | beta    |       2 |
 > | gamma   |       3 |
 > |---------+---------|
   | column1 | column2 |
 > | alpha   |       1 |
 > | beta    |       2 |
 > | gamma   |       3 |
 > |---------+---------|
   | column1 | column2 |
 > | alpha   |       1 |
 > | beta    |       2 |
 > | gamma   |       3 |
 > |---------+---------|


Is there multiline text, as well?

I'm afraid there's nothing built in that can handle your requirements.

You can always achieve that with a bit of coding, however. I'm not sure how 
comfortable it would be for you, though - it might get quite convoluted, and at 
that point I somewhat doubt if it makes sense to use Emacs for such tabular 
data at all (I usually think that it's best to choose the right tool for the 
job).

That said, if you still want to copy the data from Calc into Emacs and format 
it according to your needs, you have two options:

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;

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)))

--
Best regards,
Platon Pronko
PGP 2A62D77A7A2CB94E




reply via email to

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