3

In my org file i have the following table:

#+CAPTION: Заголовок пакета
| № | Размер | Тип      | Значение              |
|   | (байт) |          |                       |
|---+--------+----------+-----------------------|
| 1 |      1 | unsigned | *Маркер начала*       |
|   |        |          | константа 0xAC        |
|---+--------+----------+-----------------------|
| 2 |      1 | unsigned | *Размер данных*       |
|   |        |          | в байтах, от 1 до 255 |
|---+--------+----------+-----------------------|
| 3 |      1 | unsigned | *Контрольная сумма*   |
|   |        |          | по алгоритму CRC-8    |

Table was made with liberal application of org-table-wrap-region.

What i want/need: after export (to odt, doc/docx etc) have cells with multi-line contents. How do i achieve that?

Naive experimentation with built-in org export and pandoc produces tables where every line of text in original table becomes a row. What can i do to change that?

P.S. Pandoc documentation mentions multiline_tables and 'grid_tables' extensions. However, even after turning them on, i still get the same picture. Probably tables should be rewritten - but in that case, how do i reconcile output of org tables editor with the needs of pandoc input?

2 Answers 2

1

I couldn't find the way to do it in plain org.

So for that kind of tables I use latex tables (tabular and longtable) and export to pdf.

#+BEGIN_LATEX
\begin{table}[H]
\caption{Перечень сокращений}
\begin{center}
\begin{tabular}{|m{6cm}|m{10cm}|}
\hline
\theadfst{Сокращения} & \thead{Расшифровка} \\ \hline
АС     & Автоматизированная система\\ \hline
АРМ    & Автоматизированное рабочее место предназначенное для аудитора информационной безопасности\\ \hline
НСИ    & Нормативно-справочная информация\\ \hline
ЦХД    & Централизованное хранилище данных\\ \hline
ODS    & Оперативное хранилище данных на базе технологии Exadata и Golden Gate.\\ \hline
\end{tabular}
\end{center}
\end{table}
#+END_LATEX

One of the latest msword versions which I have can open PDFs as a docx. The formatting including tables and pictures are 99% fine.

пример

PS theadfst and thead macros I have in a latex class setup:

\newcommand{\theadfst}[1]{\multicolumn{1}{|c|}{\textbf{#1}}}
\newcommand{\thead}[1]{\multicolumn{1}{c|}{\textbf{#1}}}

PPS

If you include makecell package, then your example could be made with the following latex:

#+BEGIN_LATEX
\begin{table}[H]
\caption{Заголовок пакета}
\begin{center}
\begin{tabular}{|m{1cm}|m{1.5cm}|m{2cm}|m{4cm}|}
\hline
\thead{№} & \thead{Размер \\ (байт)} & \thead{Тип} & \thead{Значение} \\ \hline
1 & 1 & unsigned & \makecell[l]{\bfseries{Маркер начала} \\ константа 0xAC}\\ \hline
2 & 1 & unsigned & \makecell[l]{\bfseries{Размер данных} \\ в байтах, от 1 до 255}\\ \hline
3 & 1 & unsigned & \makecell[l]{\bfseries{Контрольная сумма} \\ по алгоритму CRC-8}\\ \hline
\end{tabular}
\end{center}
\end{table}
#+END_LATEX

picture2

3
  • theadfst and thead are latex macros for bold headings.
    – Maxim Kim
    Commented Sep 6, 2016 at 7:50
  • I see. This answer is formally acceptable, but writing latex tables is kind of self defeating (one can write an html table with the same success). Using org table editor is easy and pleasant, writing LaTeX or html table definitions - not so.
    – Srv19
    Commented Sep 7, 2016 at 7:50
  • yep, org tables are good but not good enough in some environments (russian corporate docs with a lot of sofisticated tables)
    – Maxim Kim
    Commented Sep 7, 2016 at 9:31
0

IIUC, the concern expressed here is to sneak in line breaks (on the export side) when using an Org table.

Good news is not only can you sneak in line breaks, you can also create multiparagraph content in ODT export, provided you are using the enhanced ODT exporter.

The enhanced ODT backend is not available with standard Emacs or Org mode, and you need to install it separately. See Getting Started with ODT export (OpenDocument Text Exporter for Emacs’ Org Mode for instructions.

The snippet below uses

  1. Transcluded Tables.
  2. Use of :col-cookies for sizing and formatting of cell contents.. Note that some of the cells are vertically centered
  3. Use of LANGUAGE feature to set the locale of exported document to Russian

All the above features, specifically, Transcluded Tables and picking of ODT-document's locale through the use of #+LANGUAGE keyword are exclusive to the enhanced ODT backend.

(The transcluded table feature and picking the locale on ODT-side are not enabled by default. So, before exporting, remember to execute the emacs lisp source block (C-c C-c) you find at the start of the snippet)*

See List of features that are exclusive to The Enhanced OpenDocument Exporter for Org mode for more information.

If you want this,

Multi-paragraph content using Transcluded Table in ODT Export

do this

#+language: ru_RU

#+begin_src emacs-lisp :exports results :results silent
(add-to-list 'org-odt-experimental-features 'transclude-sole-footnote-references-in-a-table)
(add-to-list 'org-odt-experimental-features 'language)
#+end_src

#+ATTR_ODT: :style "GriddedTable"
#+ATTR_ODT: :col-cookies "| cm10 |                cm15 | cm20      | m40        |"
#+ATTR_ODT: :rel-width 70
#+CAPTiON: Заголовок пакета
| *№* | [fn:1] | *Тип*    | *Значение* |
|-----+---------+----------+------------|
|   1 |       1 | unsigned | [fn:2]     |
|   2 |       1 | unsigned | [fn:3]     |
|   3 |       1 | unsigned | [fn:4]     |

* Footnotes

[fn:1]

#+ATTR_ODT: :style "Text_20_body_20_bold"
*Размер\\
(байт)*

[fn:2]
Маркер начала\\
константа 0xAC

Маркер начала\\
константа 0xAC

[fn:3]
Размер данных\\
в байтах, от 1 до 255

[fn:4]
Контрольная сумма\\
oпо алгоритму CRC-8

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.