Function: org--libreoffice-table-handler

org--libreoffice-table-handler is a byte-compiled function defined in org.el.gz.

Signature

(org--libreoffice-table-handler MIMETYPE DATA)

Documentation

Insert LibreOffice Calc table DATA as an Org table.

DATA is in the TSV format.

Source Code

;; Defined in /usr/src/emacs/lisp/org/org.el.gz
(defun org--libreoffice-table-handler (_mimetype data)
  "Insert LibreOffice Calc table DATA as an Org table.
DATA is in the TSV format."
  ;; Some LibreOffice versions have the null byte in the selection.
  ;; It should be safe to remove it.
  (when (string-search "\0" data)
    (setq data (string-replace "\0" "" data)))
  (let ((orig-buf (current-buffer)))
    (with-temp-buffer
      (decode-coding-string data 'undecided nil (current-buffer))
      (let ((tmp (current-buffer))
            (nlines (count-lines (point-min) (point-max))))
        (when (> nlines org-table-convert-region-max-lines)
          (unless (yes-or-no-p
                   (format "Inserting large table with %d lines, more than `org-table-convert-region-max-lines'.  Continue? "
                           nlines))
            (user-error "Table is larger than limit `org-table-convert-region-max-lines'")))
        ;; User has chosen to ignore the limit.
        (let ((org-table-convert-region-max-lines most-positive-fixnum))
          (org-table-convert-region (point-min) (point-max)))
        (with-current-buffer orig-buf
          (insert-buffer-substring tmp))))))