emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] org->odt/html table export: adjusting default behaviour?


From: Jambunathan K
Subject: Re: [O] org->odt/html table export: adjusting default behaviour?
Date: Mon, 29 Aug 2011 04:03:28 +0530
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (windows-nt)

Matt

>  It would be nice if I could code the table formatting into the org
> file so that I don't have to hand-fix the formatting on each
> iteration.

Thanks for your feedback. 

I have worked up a patch which intends to give users more control over
how tables are formatted. The patch modifies files that I don't own so
the changes will take sometime to hit the repo.

With this patch applied one can
1. Choose the style of the table (Is the table wide or narrow?)
2. Control relative size of the individual columns

The new feature is best illustrated by an example. If you look at the
attached file you will see that:

1. The first table which has only 2 columns and less text has the
   following attribute.

,----
|    #+ATTR_ODT: OrgTableSmall
`----

   The intention is to format the table so that it occupies lesser
   width. 

   The table styles are stored in
   contrib/odt/styles/OrgOdtAutomaticStyles.xml. Visit this file and
   look for "OrgTable" property and you will that it occupies 90% of
   page width. 

,---- OrgTable
|   <style:style style:name="OrgTable" style:family="table">
|    <style:table-properties style:rel-width="90%" table:align="center"/>
|   </style:style>
`----

   Now I add another entry "OrgTableSmall" which occupies 30% of page
   width as below

,---- OrgTableSmall
|   <style:style style:name="OrgTableSmall" style:family="table">
|    <style:table-properties style:rel-width="30%" table:align="center"/>
|   </style:style>
`----

2. Modify the bigger table as below
   - specify no #+ATTR_ODT
     This will ensure that the default 90% style is used for the table
   - indicate colgroups (Note the new row full of "<>" as field entries)
     This will ensure that exported table will have vertical grid lines
   - horizontal separators
     This will ensure that exported table has horizontal grid lines
   - The width specifier has been adjusted so that exported table is
     well-balanced. Note that the "Readings" columns which has no
     entries is given very negligible weightage and other columns has
     fairly good weightage.

3. Export the file to Odt.

4. Now you will have a resonably good looking Table. To make it more
   pleasing you need to reduce the font size of the table entries. This
   you can do by F11->Paragraph Styles->OrgTableContents-><set font size
   to 10 pt> 

   Or 

   If you are imaptient you can grok the
   contrib/odt/styles/OrgOdtStyles.xml file for "OrgTableContents" and
   fix the font-size there.

I am attaching the resulting file at the end of step 4. 

Hope these adjustments make the export of table more flexible. Let me
know what you know think.

Rant: The only way to customize Tables in LibreOffice is through the
Autoformat utility. The OASIS specification clearly outlines ways to
create custom table-related styles. Unfortunately, the state of affairs
with LibreOffice is such that such styles are ignored when used. So one
has to really rely on automatic styles for formatting of tables going
forward. This makes styling of tables a bit more involved for me - the
developer and you - the user.

Thanks, 
Jambunathan K.

-- 

Attachment: table.org
Description: Text Data

Attachment: table.odt
Description: table.odt


reply via email to

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