2013-07-18 11 views

答えて

2
  1. この領域に印を付けます。
  2. M-x replace-string
  3. |
  4. C-QのTABのRET

あなたはそれを微調整したい場合は、replace-regexを使用しています。

+0

はい、これはうまくいくはずですが、これを行うには 'orgtbl'コマンドが含まれていますか? OPが尋ねたように、逆の 'C-c | 'のようなものです。 – quazgar

+0

賢い解決策、ありがとう! –

4

タブで区切られた値については、orgtbl-to-tsvを試してください。

カンマ区切りの値には、orgtbl-to-csvもあります。例えば

:ここ

* Some heading 

    #+name: foo 
    | a | b | c | 
    |---+---+---| 
    | 1 | 2 | 3 | 
    | 4 | 5 | 6 | 

    #+BEGIN_SRC elisp :var x=foo 
    (orgtbl-to-csv x nil) 
    #+END_SRC 

    #+RESULTS: 
    : 1,2,3 
    : 4,5,6 
+0

それは正確に質問が避けたかったものではありませんか?最初に 'org-table-export'と入力し、次に' orgtbl-to-tsv'を選択します。 – quazgar

+0

ありがとう、私はEmacsでバージョン管理された_GNU Emacs 24.3.1(i386-mingw-nt6.1。7601)_、MARVINの2013-03-17何か案は? –

+0

@quazgar:編集した回答は役に立ちますか? – Nick

2

はタブまたはカンマ区切り値としてエクスポートするテーブルを使用する手順は、次のとおりです

  1. コマンドORG-テーブル・エクスポートを使用してください。 M-x org-table-export
  2. 保存するファイル名を入力します(または同じファイルの場合はEnterキーを押します)。
  3. フォーマットを選択します(ここでは、orgtbl-to-tsvまたはその他のフォーマットを設定できます)。

これらを使用することができますフォーマットの一部です:

    orgtblツージェネリックorgtblツーCSV
  • orgtbl-へ orgtblからHTMLへの
  • orgtbl対のTexinfo -latex
  • orgtblツーorgtbl
  • orgtblツーTSV
0

私はORG-テーブル輸出に基づいて次のことを書いた、あまりにも、ちょうどこれを必要に応じて:

(defun org-table-transform-in-place() 
    "Just like `ORG-TABLE-EXPORT', but instead of exporting to a 
    file, replace table with data formatted according to user's 
    choice, where the format choices are the same as 
    org-table-export." 
    (interactive) 
    (unless (org-at-table-p) (user-error "No table at point")) 
    (org-table-align) 
    (let* ((format 
     (completing-read "Transform table function: " 
       '("orgtbl-to-tsv" "orgtbl-to-csv" "orgtbl-to-latex" 
       "orgtbl-to-html" "orgtbl-to-generic" 
       "orgtbl-to-texinfo" "orgtbl-to-orgtbl" 
       "orgtbl-to-unicode"))) 
    (curr-point (point))) 
    (if (string-match "\\([^ \t\r\n]+\\)\\(+.*\\)?" format) 
    (let ((transform (intern (match-string 1 format))) 
      (params (and (match-end 2) 
       (read (concat "(" (match-string 2 format) ")")))) 
      (table (org-table-to-lisp 
       (buffer-substring-no-properties 
       (org-table-begin) (org-table-end))))) 
     (unless (fboundp transform) 
     (user-error "No such transformation function %s" transform)) 
     (save-restriction 
     (with-output-to-string 
      (delete-region (org-table-begin) (org-table-end)) 
      (insert (funcall transform table params) "\n"))) 
     (goto-char curr-point) 
     (beginning-of-line) 
     (message "Tranformation done.")) 
     (user-error "Table export format invalid")))) 

(define-key org-mode-map (kbd "\C-x |") 'org-table-transform-in-place) 

これはORG-モードに適切に追加しまった場合、それは素晴らしいことです私は多くがそれを使用すると思います。

関連する問題