emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Bug: Bad ODT files when including multiple images [7.9.3f (release_7.9.3f-17-g7524ef @ /usr/share/emacs/24.3/lisp/org/)]
@ 2013-12-02 17:22 Enrico Scholz
  2013-12-02 20:10 ` Jambunathan K
  0 siblings, 1 reply; 11+ messages in thread
From: Enrico Scholz @ 2013-12-02 17:22 UTC (permalink / raw)
  To: emacs-orgmode

Hi,

org-mode generates ODT files which can not be opened by libreoffice-4.1.3.2
when more than one image is included. E.g. running (org-export-as-odt) on

---- test.org ---
* Test

[[file:s01.png]]

[[file:s01.png]]
-----

and trying to open it with 'oowrite test.odt' gives a "Read-Error/Error
reading file" message.  ODT created after removing one of the images is
ok.

It seems that libreoffice requires an unique 'draw:name' attribute for
'draw:frame' tags.  This can be set by '#+CAPTION' (and the resulting
ODT is working) but this option is not suitable for inline images.



Enrico


Emacs  : GNU Emacs 24.3.1 (x86_64-redhat-linux-gnu, GTK+ Version 2.24.19)
 of 2013-08-19 on koji-builder0.intern.sigma-chemnitz.de
Package: Org-mode version 7.9.3f (release_7.9.3f-17-g7524ef @ /usr/share/emacs/24.3/lisp/org/)

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Bug: Bad ODT files when including multiple images [7.9.3f (release_7.9.3f-17-g7524ef @ /usr/share/emacs/24.3/lisp/org/)]
  2013-12-02 17:22 Bug: Bad ODT files when including multiple images [7.9.3f (release_7.9.3f-17-g7524ef @ /usr/share/emacs/24.3/lisp/org/)] Enrico Scholz
@ 2013-12-02 20:10 ` Jambunathan K
  2013-12-02 23:54   ` Enrico Scholz
  2013-12-03 11:06   ` Enrico Scholz
  0 siblings, 2 replies; 11+ messages in thread
From: Jambunathan K @ 2013-12-02 20:10 UTC (permalink / raw)
  Cc: emacs-orgmode


> 7.9.3f (release_7.9.3f-17-g7524ef @ /usr/share/emacs/24.3/lisp/org/)]

The exporter(s) are re-written.  You should be using Org-8.*.

Use Elpa

   M-x list-packages

and install the org package.

or install from tar file or git.


orgmode.org/worg has instructions on how to use the "new exporters".

If problem persists with new exporter, let me know.  I will be happy to
share a fix.

Enrico Scholz <enrico.scholz@sigma-chemnitz.de> writes:

> Hi,
>
> org-mode generates ODT files which can not be opened by libreoffice-4.1.3.2
> when more than one image is included. E.g. running (org-export-as-odt) on
>
> ---- test.org ---
> * Test
>
> [[file:s01.png]]
>
> [[file:s01.png]]
> -----
>
> and trying to open it with 'oowrite test.odt' gives a "Read-Error/Error
> reading file" message.  ODT created after removing one of the images is
> ok.
>
> It seems that libreoffice requires an unique 'draw:name' attribute for
> 'draw:frame' tags.  This can be set by '#+CAPTION' (and the resulting
> ODT is working) but this option is not suitable for inline images.
>
>
>
> Enrico
>
>
> Emacs  : GNU Emacs 24.3.1 (x86_64-redhat-linux-gnu, GTK+ Version 2.24.19)
>  of 2013-08-19 on koji-builder0.intern.sigma-chemnitz.de
> Package: Org-mode version 7.9.3f (release_7.9.3f-17-g7524ef @
> /usr/share/emacs/24.3/lisp/org/)

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Bug: Bad ODT files when including multiple images [7.9.3f (release_7.9.3f-17-g7524ef @ /usr/share/emacs/24.3/lisp/org/)]
  2013-12-02 20:10 ` Jambunathan K
@ 2013-12-02 23:54   ` Enrico Scholz
  2013-12-03 11:06   ` Enrico Scholz
  1 sibling, 0 replies; 11+ messages in thread
From: Enrico Scholz @ 2013-12-02 23:54 UTC (permalink / raw)
  To: Jambunathan K; +Cc: emacs-orgmode

Jambunathan K <kjambunathan@gmail.com> writes:

>    M-x list-packages
>
> and install the org package.

this seems to be completely broken: export by C-c C-e o o fails with

| OpenDocument export failed: Invalid function: org-with-silent-modifications


> If problem persists with new exporter, let me know.  I will be happy to
> share a fix.

From reading ox-odt.el, it is very likely that it still exists.  There
is no place except with short-caption where 'draw:name' will be set.



Enrico

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Bug: Bad ODT files when including multiple images [7.9.3f (release_7.9.3f-17-g7524ef @ /usr/share/emacs/24.3/lisp/org/)]
  2013-12-02 20:10 ` Jambunathan K
  2013-12-02 23:54   ` Enrico Scholz
@ 2013-12-03 11:06   ` Enrico Scholz
  2013-12-03 13:53     ` Christian Moe
  1 sibling, 1 reply; 11+ messages in thread
From: Enrico Scholz @ 2013-12-03 11:06 UTC (permalink / raw)
  To: Jambunathan K; +Cc: emacs-orgmode

Jambunathan K <kjambunathan@gmail.com> writes:

> If problem persists with new exporter, let me know.  I will be happy to
> share a fix.

yes; reproduced with

Org-mode version 8.2.3c (8.2.3c-17-gc92606-elpa @ /home/ensc/.emacs.d/elpa/org-20131202/)



Enrico

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Bug: Bad ODT files when including multiple images [7.9.3f (release_7.9.3f-17-g7524ef @ /usr/share/emacs/24.3/lisp/org/)]
  2013-12-03 11:06   ` Enrico Scholz
@ 2013-12-03 13:53     ` Christian Moe
  2013-12-03 14:25       ` Enrico Scholz
  2013-12-03 15:47       ` Jambunathan K
  0 siblings, 2 replies; 11+ messages in thread
From: Christian Moe @ 2013-12-03 13:53 UTC (permalink / raw)
  To: Enrico Scholz; +Cc: emacs-orgmode


Hi,

This problem was also reported by Tyler Smith a couple of weeks back. I
confirmed it and did a little checking. Unfortunately I also sort of
promised a patch, which I never got around to. 

Instead, let me report what I've found about the syntax:

It seems LibreOffice 4.1 now requires that draw:frame elements wrapping
images be uniquely named with the draw:name attribute if there's more
than one of them.

Multiple uncaptioned images fail because Org currently wraps them in
frames without these attributes.

e.g. a simple document containing

  [[file:test1.jpg]]

  [[file:test2.jpg]]

results in unnamed image frames, e.g. for the first image of the
example:

  <draw:frame draw:style-name="OrgDisplayImage" 
  svg:width="12.70cm" svg:height="12.70cm" text:anchor-type="paragraph">

  <draw:image xlink:href="Images/0001.jpg" xlink:type="simple"
  xlink:show="embed" xlink:actuate="onLoad"/> 

  </draw:frame>

This now results in a read error in LibreOffice 4.1. LibreOffice uses
draw:name="graphics1", "graphics2" etc. for the draw:frame element when
a picture is inserted, but I think any unique value will do.

The problem does not occur if you add captions to the images. Then the
draw:frame gets a draw:name attribute containing the caption text.

e.g. 

  #+caption: A picture
  [[file:test1.jpg]]

  #+caption: Another picture
  [[file:test2.jpg]]

exports without a problem, because it results in draw:frame elements
like (for the first picture of the example):

  <draw:frame draw:style-name="OrgCaptionedImage" (...)
  draw:name="A picture" text:anchor-type="paragraph">
  ^^^^^^^^^^^^^^^^^^^^^
  
However, this only works as long as each caption is unique. If you have
more than one image with identical #+captions, even if they have different
#+names, you get the read error. 

So we may need a fix for the corner case of identical captions as well.

I haven't checked what other elements may be affected by similar new
requirements besides images.

Yours,
Christian

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Bug: Bad ODT files when including multiple images [7.9.3f (release_7.9.3f-17-g7524ef @ /usr/share/emacs/24.3/lisp/org/)]
  2013-12-03 13:53     ` Christian Moe
@ 2013-12-03 14:25       ` Enrico Scholz
  2013-12-03 14:41         ` Christian Moe
  2013-12-03 15:47       ` Jambunathan K
  1 sibling, 1 reply; 11+ messages in thread
From: Enrico Scholz @ 2013-12-03 14:25 UTC (permalink / raw)
  To: Christian Moe; +Cc: emacs-orgmode

Christian Moe <mail@christianmoe.com> writes:

> It seems LibreOffice 4.1 now requires that draw:frame elements wrapping
> images be uniquely named with the draw:name attribute if there's more
> than one of them.
> ...
> So we may need a fix for the corner case of identical captions as
> well.

Why do we need meaningful 'draw:name' values at all?  And why use the
caption for it?  Just adding 'draw:name="Image%u"' and incrementing the
index after each use seems to be enough.

Alternatively, '#+NAME:' seems to be a much better choice than
#+CAPTION.


Enrico

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Bug: Bad ODT files when including multiple images [7.9.3f (release_7.9.3f-17-g7524ef @ /usr/share/emacs/24.3/lisp/org/)]
  2013-12-03 14:25       ` Enrico Scholz
@ 2013-12-03 14:41         ` Christian Moe
  0 siblings, 0 replies; 11+ messages in thread
From: Christian Moe @ 2013-12-03 14:41 UTC (permalink / raw)
  To: Enrico Scholz; +Cc: emacs-orgmode


Enrico Scholz writes:

>> It seems LibreOffice 4.1 now requires that draw:frame elements wrapping
>> images be uniquely named with the draw:name attribute if there's more
>> than one of them.
>> ...
>> So we may need a fix for the corner case of identical captions as
>> well.
>
> Why do we need meaningful 'draw:name' values at all?  And why use the
> caption for it?  Just adding 'draw:name="Image%u"' and incrementing the
> index after each use seems to be enough.

Indeed, that sounds like a simple all-round fix, and better than one
solution for uncaptioned images and a fragile one for captioned
ones. Did a quick test replacing the draw:name attributes for captioned
images with such generic names, and it didn't seem to cause any
problems.

> Alternatively, '#+NAME:' seems to be a much better choice than
> #+CAPTION.

But not a good one, since users do not necessarily name images.

Yours,
Christian

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Bug: Bad ODT files when including multiple images [7.9.3f (release_7.9.3f-17-g7524ef @ /usr/share/emacs/24.3/lisp/org/)]
  2013-12-03 13:53     ` Christian Moe
  2013-12-03 14:25       ` Enrico Scholz
@ 2013-12-03 15:47       ` Jambunathan K
  2013-12-17 14:04         ` Tim
  1 sibling, 1 reply; 11+ messages in thread
From: Jambunathan K @ 2013-12-03 15:47 UTC (permalink / raw)
  To: Christian Moe; +Cc: Enrico Scholz, emacs-orgmode

Christian Moe <mail@christianmoe.com> writes:

> This problem was also reported by Tyler Smith a couple of weeks back.

I was able to open test.odt provided by Tyler just fine.  Hence I did
not follow up the post (IIRC, Christian was also indicating a "no
issue".)

    http://permalink.gmane.org/gmane.emacs.orgmode/78579

I am using LibreOffice 4.0.1.2.

Tyler says he is using 4.0.4.2.  OP is using LibreOffice-4.1.3.2.  Is it
a problem only with recent LibreOffices?

Let me upgrade my LibreOffice and report back.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Bug: Bad ODT files when including multiple images [7.9.3f (release_7.9.3f-17-g7524ef @ /usr/share/emacs/24.3/lisp/org/)]
  2013-12-03 15:47       ` Jambunathan K
@ 2013-12-17 14:04         ` Tim
  2013-12-17 18:46           ` Jambunathan K
  0 siblings, 1 reply; 11+ messages in thread
From: Tim @ 2013-12-17 14:04 UTC (permalink / raw)
  To: emacs-orgmode

At Tue, 03 Dec 2013 21:17:06 +0530,
Jambunathan K wrote:
> 
> Let me upgrade my LibreOffice and report back.
> 
Jambunathan,
   was wondering if you had a chance to look at this error ?  I can confirm
it is an issue on my Ubuntu 13.10 system with :
   - emacs 24.3.1
   - org-mode 8.2.4 (org-plus-contrib elpa package 20131216)
   - libreoffice 4.1.3.2

I use the odt export to create student handouts and *really* don't want to go
back through 200+ documents to add captions to all of the images !

Thanks

-Tim 

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Bug: Bad ODT files when including multiple images [7.9.3f (release_7.9.3f-17-g7524ef @ /usr/share/emacs/24.3/lisp/org/)]
  2013-12-17 14:04         ` Tim
@ 2013-12-17 18:46           ` Jambunathan K
  2013-12-17 19:28             ` Tim
  0 siblings, 1 reply; 11+ messages in thread
From: Jambunathan K @ 2013-12-17 18:46 UTC (permalink / raw)
  Cc: emacs-orgmode

Tim <wiskey5alpha@gmail.com> writes:

> Jambunathan,
>    was wondering if you had a chance to look at this error ?  I can confirm
> it is an issue on my Ubuntu 13.10 system with :
>    - emacs 24.3.1
>    - org-mode 8.2.4 (org-plus-contrib elpa package 20131216)
>    - libreoffice 4.1.3.2

I can see the problem on my side.

> I use the odt export to create student handouts and *really* don't
> want to go back through 200+ documents to add captions to all of the
> images !

This issue is a bit unfortunate.  Please don't modify your Org files.  I
will circulate a fix - if not a fix, atleast a workaround - in another
day.

Jambunathan K.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Bug: Bad ODT files when including multiple images [7.9.3f (release_7.9.3f-17-g7524ef @ /usr/share/emacs/24.3/lisp/org/)]
  2013-12-17 18:46           ` Jambunathan K
@ 2013-12-17 19:28             ` Tim
  0 siblings, 0 replies; 11+ messages in thread
From: Tim @ 2013-12-17 19:28 UTC (permalink / raw)
  To: emacs-orgmode

At Wed, 18 Dec 2013 00:16:25 +0530,
Jambunathan K wrote:
> 
> Tim <wiskey5alpha@gmail.com> writes:
> 
> > Jambunathan,
> >    was wondering if you had a chance to look at this error ?  I can confirm
> > it is an issue on my Ubuntu 13.10 system with :
> >    - emacs 24.3.1
> >    - org-mode 8.2.4 (org-plus-contrib elpa package 20131216)
> >    - libreoffice 4.1.3.2
> 
> I can see the problem on my side.
> 
> > I use the odt export to create student handouts and *really* don't
> > want to go back through 200+ documents to add captions to all of the
> > images !
> 
> This issue is a bit unfortunate.  Please don't modify your Org files.  I
> will circulate a fix - if not a fix, atleast a workaround - in another
> day.

Thank you !

-Tim

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2013-12-17 19:28 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-02 17:22 Bug: Bad ODT files when including multiple images [7.9.3f (release_7.9.3f-17-g7524ef @ /usr/share/emacs/24.3/lisp/org/)] Enrico Scholz
2013-12-02 20:10 ` Jambunathan K
2013-12-02 23:54   ` Enrico Scholz
2013-12-03 11:06   ` Enrico Scholz
2013-12-03 13:53     ` Christian Moe
2013-12-03 14:25       ` Enrico Scholz
2013-12-03 14:41         ` Christian Moe
2013-12-03 15:47       ` Jambunathan K
2013-12-17 14:04         ` Tim
2013-12-17 18:46           ` Jambunathan K
2013-12-17 19:28             ` Tim

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).