Re: [O] question about ODT export behavior

2011-07-15 Thread Renzo Been
Jambunathan K  gmail.com> writes:

> >> Can you give me a hint where I can find some documentation about
> >> changing the styles.xml?
> >
> > You can have a look at contrib/odt/README.org.  Jambunathan points 
> > to this message, which can help:
> >
> >   http://lists.gnu.org/archive/html/emacs-orgmode/2011-03/msg01460.html
> 
> Here is the relevant variable.
> 
> ,[ C-h v org-export-odt-styles-file RET ]
> | org-export-odt-styles-file is a variable defined in `org-odt.el'.
> `
> 
> Here is a specific example:
> 
> ,
> | (setq org-export-odt-styles-file
> |   '("~/tmp-orgmode/Thu Thong Bao - Trai Ve Nguon XV (2011).odt"
> `
> 
> I am seeing that customization interface for org-export-odt-styles-file
> variable is only partially done. If the customization interface doesn't
> do the right thing for you, you can use the setq form temporarily.
> 
> The default styles file used by the odt exporter is:
> org-root-dir/contrib/odt/styles/OrgOdtStyles.xml
> 
> There is also an automatic styles file in there.
> 
> If you are interested in customizing the styles you could do this:
> 
> 1. Export test.org to test.odt
> 
> 2. Open test.odt and use the OpenOffice stylist to change the
>user-defined styles. The Org-specific user stlyes have `Org' as a
>prefix. 
> 
>Hint: One can use M-x occur RET Org RET in OrgOdtStyles.xml buffer to
>see the Org specific styles.
> 
>Caution: The style-names used in the styles.xml are the style-names
>written out in content.xml. So it is important that the style-names
>be not changed at all. 
> 
> 3. Save the newly styled test.odt as say ~/.emacs.d/org-odt/custom.odt
>or ~/.emacs.d/org-odt/custom.ott file.
> 
> 4. Use one of the following:
> 
>1. Customize org-export-odt-styles-file to the custom.odt or
>   custom.ott file.
> 
>2. If you are a bit adventurous, you can open the newly saved
>   test.odt in an archive-mode, extract the styles.xml and save it to
>   ~/.emacs.d/org-odt/user-styles.xml.
> 
>   Then customize org-export-odt-styles-file to point to the above
>   styles.xml file.
> 
> I anticipate more questions and follow-on enhancements to styles
> interface as more and more people start using it. So all inputs are
> welcome.
> 
> Jambunathan K.
> 
> >
> > HTH,

Hi,

First of all; I want to thank you for this great addon to org-mode. Being able
to export directly to OpenOffice documents is good for sharing my document with
friends.

I just want to add one point that I did not find in the org-manual.  I tested
some of my org-files and exported them to the OpenOffice format. When I tried to
open these documents in OpenOffice, they were corrupt and could not be opened.

I soon found out why. If you want to export an org-mode file to .odt, you need
to explicitly set the file encoding to UTF-8 (I usually use iso-8859-1 encoding
for my files), like:
#-*- mode: org; coding: utf-8; -*-
After that OpenOffice could open the files without any problems.

Thanx again, and I will follow your explanation below, to create my own
styles.xml

Ciao,
Renzo




Re: [O] question about ODT export behavior

2011-07-14 Thread Jambunathan K

>> Can you give me a hint where I can find some documentation about
>> changing the styles.xml?
>
> You can have a look at contrib/odt/README.org.  Jambunathan points 
> to this message, which can help:
>
>   http://lists.gnu.org/archive/html/emacs-orgmode/2011-03/msg01460.html

Here is the relevant variable.

,[ C-h v org-export-odt-styles-file RET ]
| org-export-odt-styles-file is a variable defined in `org-odt.el'.
| Its value is nil
| 
| Documentation:
| Default style file for use with ODT exporter.
| Valid values are path to an styles.xml file or a path to a valid
| *.odt or a *.ott file or a list of the form (FILE (MEMBER1
| MEMBER2 ...)). In the last case, the specified FILE is unzipped
| and MEMBER1, MEMBER2 etc are copied in to the generated odt
| file. The last form is particularly useful if the styles.xml has
| reference to additional files like header and footer images.
| 
| 
| You can customize this variable.
| 
| [back]
`

Here is a specific example:

,
| (setq org-export-odt-styles-file
|   '("~/tmp-orgmode/Thu Thong Bao - Trai Ve Nguon XV (2011).odt"
| ("styles.xml" "Pictures/1274034B83A526F3.png")))
| 
| the styles.xml and header images would get copied on to the generated
| odt file. 
| 
| If the desired styles.xml makes no references to other files (as in the
| example above) then the above variable could be set to 
| 
| (setq org-export-odt-styles-file
|   "~/tmp-orgmode/Thu Thong Bao - Trai Ve Nguon XV (2011).odt")
| 
| or 
| 
| (setq org-export-odt-styles-file "~/elisp/styles.xml")
`

I am seeing that customization interface for org-export-odt-styles-file
variable is only partially done. If the customization interface doesn't
do the right thing for you, you can use the setq form temporarily.

The default styles file used by the odt exporter is:
org-root-dir/contrib/odt/styles/OrgOdtStyles.xml

There is also an automatic styles file in there.


If you are interested in customizing the styles you could do this:

1. Export test.org to test.odt

2. Open test.odt and use the OpenOffice stylist to change the
   user-defined styles. The Org-specific user stlyes have `Org' as a
   prefix. 

   Hint: One can use M-x occur RET Org RET in OrgOdtStyles.xml buffer to
   see the Org specific styles.

   Caution: The style-names used in the styles.xml are the style-names
   written out in content.xml. So it is important that the style-names
   be not changed at all. 

3. Save the newly styled test.odt as say ~/.emacs.d/org-odt/custom.odt
   or ~/.emacs.d/org-odt/custom.ott file.

4. Use one of the following:

   1. Customize org-export-odt-styles-file to the custom.odt or
  custom.ott file.

   2. If you are a bit adventurous, you can open the newly saved
  test.odt in an archive-mode, extract the styles.xml and save it to
  ~/.emacs.d/org-odt/user-styles.xml.

  Then customize org-export-odt-styles-file to point to the above
  styles.xml file.

I anticipate more questions and follow-on enhancements to styles
interface as more and more people start using it. So all inputs are
welcome.

Jambunathan K.

>
> HTH,

-- 



Re: [O] question about ODT export behavior

2011-07-14 Thread Bastien
Hi Rainer,

Rainer Stengele  writes:

> Yes. That was it. After changing
>
> org-export-preserve-breaks
>
> to nil the breaks are gone.

Thanks for confirming.

> Sorry,  I did not know how the exporter works. I did therefore not
> check the export options.

Perhaps we could add a FAQ for this in Worg.

> Can you give me a hint where I can find some documentation about
> changing the styles.xml?

You can have a look at contrib/odt/README.org.  Jambunathan points 
to this message, which can help:

  http://lists.gnu.org/archive/html/emacs-orgmode/2011-03/msg01460.html

HTH,

-- 
 Bastien



Re: [O] question about ODT export behavior

2011-07-13 Thread Rainer Stengele
Am 13.07.2011 22:15, schrieb Jambunathan K:
> Jambunathan K  writes:
>
>> Rainer Stengele  writes:
>>
>>> Hi,
>>>
>>> having this in an org file:
>>> --
>>> * Test
>>> ** header 2
>>>- item 1
>>>  * subitem 11
>>>  * subitem 12
>>>- item 2
>>>  * subitem 21
>>>  * subitem 22
>>> --
>> Could you please post your complete #+OPTIONS line - specifically the
>> `H: ' and `toc: ' option? 
> Looking at the code, I believe these options may not be relevant (for
> the odt exporter)
>
> Your org file doesn't use an explicit line break or timestamps. So the
> only scenario under which line breaks can occur is precisely when you
> have actually requested them.
>
> Check this variable or the corresponding OPTIONS directive.
>
>
> ,[ C-h v org-export-preserve-breaks RET ]
> | org-export-preserve-breaks is a variable defined in `org-exp.el'.
> | Its value is nil
> | 
> | Documentation:
> | Non-nil means preserve all line breaks when exporting.
> | Normally, in HTML output paragraphs will be reformatted.  In ASCII
> | export, line breaks will always be preserved, regardless of this variable.
> | 
> | This option can also be set with the +OPTIONS line, e.g. "\n:t".
> | 
> | You can customize this variable.
> | 
> | [back]
> `
>
>

Yes. That was it. After changing

org-export-preserve-breaks

to nil the breaks are gone.
Sorry,  I did not know how the exporter works. I did therefore not check the 
export options.

Again, thank you for your excellent work!
Bastien, thanks for helping!

Can you give me a hint where I can find some documentation about changing the 
styles.xml?

- Rainer



Re: [O] question about ODT export behavior

2011-07-13 Thread Jambunathan K
Bastien  writes:

> I cannot reproduce your error.

Same here.  

Some custom setting (global or per-file) is kicking in Rainer's
setup. It is more likely to be org-export-preserve-breaks. 

Jambunathan K.


-- 



Re: [O] question about ODT export behavior

2011-07-13 Thread Jambunathan K
Jambunathan K  writes:

> Rainer Stengele  writes:
>
>> Hi,
>>
>> having this in an org file:
>> --
>> * Test
>> ** header 2
>>- item 1
>>  * subitem 11
>>  * subitem 12
>>- item 2
>>  * subitem 21
>>  * subitem 22
>> --
>
> Could you please post your complete #+OPTIONS line - specifically the
> `H: ' and `toc: ' option? 

Looking at the code, I believe these options may not be relevant (for
the odt exporter)

Your org file doesn't use an explicit line break or timestamps. So the
only scenario under which line breaks can occur is precisely when you
have actually requested them.

Check this variable or the corresponding OPTIONS directive.


,[ C-h v org-export-preserve-breaks RET ]
| org-export-preserve-breaks is a variable defined in `org-exp.el'.
| Its value is nil
| 
| Documentation:
| Non-nil means preserve all line breaks when exporting.
| Normally, in HTML output paragraphs will be reformatted.  In ASCII
| export, line breaks will always be preserved, regardless of this variable.
| 
| This option can also be set with the +OPTIONS line, e.g. "\n:t".
| 
| You can customize this variable.
| 
| [back]
`


> How exactly are you exporting - Are you exporting the file, a subtree,
> region etc etc? 
>
> What interactive command are you using for export?
>
>> and exporting to ODT I get (I simply copied the Org doc contents via
>> clipboard) I get this:
>>
>> --
>> Test
>> Table of Contents
>> 1. header 2
>> 1.  header 2
>> item 1
>>
>> subitem 11
>>
>> subitem 12
>>
>> item 2
>>
>> subitem 21
>>
>> subitem 22
>> --
>>
>> Why do I get extra lines between the items and subitems?
>
> This is beacause there is an explicit line break at the end of the list
> items.
>
> If you open content.xml and remove the  and save the
> buffer, does the altered odt file match your expectations. 
>
> If you export the above outline with the same settings, does the HTML
> exporter also introduce  at the end of the list items?

IIRC, the (x)html exporter adds a line break after emitting an headline
which is listified.

> odt exporter is a derived from the html exporter and mimics the HTML
> exporter mindlessly. I believe the line breaks can be removed.

The odt exporter doesn't emit the line break like the xhtml
exporter. (May be I was a bit mindful while typing out org-odt.el) So
the options H, toc etc may not be relevant.

>
> Once I get the relevant details from you I can post a patch after a
> closer look.
>
>> Where or how can I adjust the behaviour of the exporter?
>>
>> I'll attach the org file.
>>
>> - Rainer
>>

-- 



Re: [O] question about ODT export behavior

2011-07-13 Thread Bastien
I cannot reproduce your error.

Check the test_bastien.org file I get by exporting your test.org, 
there is no extra line.



test_bastien.odt
Description: application/vnd.oasis.opendocument.text

-- 
 Bastien


Re: [O] question about ODT export behavior

2011-07-13 Thread Jambunathan K
Rainer Stengele  writes:

> Hi,
>
> having this in an org file:
> --
> * Test
> ** header 2
>- item 1
>  * subitem 11
>  * subitem 12
>- item 2
>  * subitem 21
>  * subitem 22
> --

Could you please post your complete #+OPTIONS line - specifically the
`H: ' and `toc: ' option? 

How exactly are you exporting - Are you exporting the file, a subtree,
region etc etc? 

What interactive command are you using for export?

> and exporting to ODT I get (I simply copied the Org doc contents via 
> clipboard) I get this:
>
> --
> Test
> Table of Contents
> 1. header 2
> 1.  header 2
> item 1
>
> subitem 11
>
> subitem 12
>
> item 2
>
> subitem 21
>
> subitem 22
> --
>
> Why do I get extra lines between the items and subitems?

This is beacause there is an explicit line break at the end of the list
items.

If you open content.xml and remove the  and save the
buffer, does the altered odt file match your expectations. 

If you export the above outline with the same settings, does the HTML
exporter also introduce  at the end of the list items?

odt exporter is a derived from the html exporter and mimics the HTML
exporter mindlessly. I believe the line breaks can be removed.

Once I get the relevant details from you I can post a patch after a
closer look.

> Where or how can I adjust the behaviour of the exporter?
>
> I'll attach the org file.
>
> - Rainer
>

-- 



Re: [O] question about ODT export behavior

2011-07-13 Thread Rainer Stengele
Am 13.07.2011 16:23, schrieb Bastien:
> Rainer Stengele  writes:
> 
>> I'll attach the org file.
> 
> You forgot the org file, you just attached the odt file.
> 
> I don't know when Jambunathan can have a loot at this, but please 
> bare in mind that such formatting issues are relatively hard to fix
> (talking from experience).
> 
> Thanks,
> 

Org file is attached.

I think this is the most simple org file - nothing special
- and the odt file just extends some extra lines, so I thought this
to be a fundamental issue.
I would like to be able to export the minutes of a meeting but cannot as my 
colleagues
will wonder why I put all these extra lines in ...

Thanks,
Rainer
* Test
** header 2
   - item 1
 * subitem 11
 * subitem 12
   - item 2
 * subitem 21
 * subitem 22


Re: [O] question about ODT export behavior

2011-07-13 Thread Bastien
Rainer Stengele  writes:

> I'll attach the org file.

You forgot the org file, you just attached the odt file.

I don't know when Jambunathan can have a loot at this, but please 
bare in mind that such formatting issues are relatively hard to fix
(talking from experience).

Thanks,

-- 
 Bastien