Issue 98430

Summary: Opening particular .ODT created by MS Word (with frame/picture in shape) fails with "read error" message
Product: Writer Reporter: divo76 <openoffice200707>
Component: open-importAssignee: AOO issues mailing list <issues>
Status: CONFIRMED --- QA Contact:
Severity: Minor    
Priority: P3 CC: issues, Mathias_Bauer, rainerbielefeld_ooo_qa
Version: OOo 3.0   
Target Milestone: ---   
Hardware: All   
OS: All   
Issue Type: DEFECT Latest Confirmation in: 4.0.0
Developer Difficulty: ---
Attachments:
Description Flags
Document containing picture inside a shape failing to open none

Description divo76 2009-01-24 15:32:01 UTC
ODF 1.0/1.1 documents containing a frame inside a shape produce an error when
trying to open in OpenOffice.org 3.0 (and I think all other versions of OOo as
well).

Steps to reproduce:
-------------------
Not possible with OOo. Create a new document in Microsoft Word, insert a shape
of any type and insert a picture inside the shape. Save the document to ODF
using MS Office 2007 SP2 or the OpenXML/ODF Translator Add-in.

Expected behavior:
------------------
Even if OOo does not support the specific feature, Writer should be able to fail
gracefully and open the valid ODF document (by simply ignoring the ODF features
that are not supported by OOo).

Generally the input parser is already quite robust; however it should also be
capable of opening documents created by other applications, especially when
these documents only used features of ODF 1.0/1.1.

Please find below the *valid* content part which was created using MS Office SP2
Beta:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<office:document-content
xmlns:anim="urn:oasis:names:tc:opendocument:xmlns:animation:1.0"
xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0"
xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0"
xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0"
xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0"
xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0"
xmlns:math="http://www.w3.org/1998/Math/MathML"
xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0"
xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0"
xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0"
xmlns:presentation="urn:oasis:names:tc:opendocument:xmlns:presentation:1.0"
xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0"
xmlns:smil="urn:oasis:names:tc:opendocument:xmlns:smil-compatible:1.0"
xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0"
xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0"
xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0"
xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0"
xmlns:xforms="http://www.w3.org/2002/xforms"
xmlns:xlink="http://www.w3.org/1999/xlink">
  <office:font-face-decls>
    <style:font-face style:name="Calibri" svg:font-family="Calibri"
style:font-family-generic="swiss" style:font-pitch="variable" svg:panose-1="2 15
5 2 2 2 4 3 2 4"/>
    <style:font-face style:name="Times New Roman" svg:font-family="Times New
Roman" style:font-family-generic="roman" style:font-pitch="variable"
svg:panose-1="2 2 6 3 5 4 5 2 3 4"/>
    <style:font-face style:name="Tahoma" svg:font-family="Tahoma"
style:font-family-generic="swiss" style:font-pitch="variable" svg:panose-1="2 11
6 4 3 5 4 4 2 4"/>
    <style:font-face style:name="Cambria" svg:font-family="Cambria"
style:font-family-generic="roman" style:font-pitch="variable" svg:panose-1="2 4
5 3 5 4 6 3 2 4"/>
  </office:font-face-decls>
  <office:automatic-styles>
    <style:style style:name="P1" style:parent-style-name="Normal"
style:master-page-name="MP0" style:family="paragraph">
      <style:paragraph-properties fo:break-before="page"/>
    </style:style>
    <style:style style:name="T2" style:parent-style-name="DefaultParagraphFont"
style:family="text">
      <style:text-properties fo:language="de" fo:country="DE"/>
    </style:style>
    <style:style style:name="P3" style:parent-style-name="Normal"
style:family="paragraph">
      <style:text-properties fo:language="de" fo:country="DE"/>
    </style:style>
    <style:style style:name="P4" style:parent-style-name="Normal"
style:family="paragraph">
      <style:text-properties fo:language="de" fo:country="DE"/>
    </style:style>
    <style:style style:name="P5" style:parent-style-name="Normal"
style:family="paragraph">
      <style:text-properties fo:language="de" fo:country="DE"/>
    </style:style>
    <style:style style:name="P6" style:parent-style-name="Normal"
style:family="paragraph">
      <style:text-properties fo:language="de" fo:country="DE"/>
    </style:style>
    <style:style style:family="graphic" style:name="a0">
      <style:graphic-properties fo:min-width="3.89514in"
fo:min-height="4.58125in" fo:wrap-option="wrap" fo:padding-top="0.05in"
fo:padding-bottom="0.05in" fo:padding-left="0.1in" fo:padding-right="0.1in"
draw:textarea-vertical-align="top" style:wrap="run-through"
style:run-through="foreground" style:writing-mode="lr-tb" draw:fill="solid"
draw:fill-color="#ffffff" draw:opacity="100%" draw:stroke="solid"
svg:stroke-width="0.01042in" svg:stroke-color="#000000"
svg:stroke-opacity="100%" draw:stroke-linejoin="round"
style:horizontal-rel="paragraph" style:vertical-rel="paragraph"
style:horizontal-pos="from-left" style:vertical-pos="from-top"
draw:auto-grow-width="false" draw:auto-grow-height="false"/>
      <style:paragraph-properties/>
    </style:style>
    <style:style style:family="graphic" style:name="a1"
style:parent-style-name="Graphics">
      <style:graphic-properties fo:border="none" fo:background-color="transparent"/>
    </style:style>
  </office:automatic-styles>
  <office:body>
    <office:text text:use-soft-page-breaks="true">
      <text:p text:style-name="P1">
        <draw:custom-shape svg:x="0.74444in" svg:y="1.05833in"
svg:width="4.58125in" svg:height="3.89514in" draw:z-index="251658240"
draw:id="id0" draw:style-name="a0" draw:name="AutoShape 2"
text:anchor-type="paragraph">
          <svg:desc/>
          <text:p text:style-name="Normal">
            <text:span text:style-name="T2">kjhkjh</text:span>
            <draw:frame draw:style-name="a1" draw:name="Picture 0"
text:anchor-type="as-char" svg:x="0in" svg:y="0in" svg:width="2.60417in"
svg:height="2.08333in" style:rel-width="scale" style:rel-height="scale">
              <draw:image xlink:href="media/image1.png" xlink:type="simple"
xlink:show="embed" xlink:actuate="onLoad"/>
              <svg:desc>cat.bmp</svg:desc>
            </draw:frame>
          </text:p>
          <text:p text:style-name="P3">lkjl</text:p>
          <text:p text:style-name="P4"/>
          <text:p text:style-name="P5">kjh</text:p>
          <text:p text:style-name="P6">l</text:p>
          <draw:enhanced-geometry draw:path-stretchpoint-x="10800"
draw:path-stretchpoint-y="10800" draw:type="non-primitive" svg:viewBox="0 0
21600 21600" draw:enhanced-path="M ?f7 0 X 0 ?f8 L 0 ?f9 Y ?f7 21600 L ?f10
21600 X 21600 ?f9 L 21600 ?f8 Y ?f10 0 Z N" draw:text-areas="?f3 ?f4 ?f5 ?f6"
draw:modifiers="3600">
            <draw:equation draw:name="f0" draw:formula="45"/>
            <draw:equation draw:name="f1" draw:formula="$0 *sin(?f0 *(pi/180))"/>
            <draw:equation draw:name="f2" draw:formula="?f1 *3163/7636"/>
            <draw:equation draw:name="f3" draw:formula="left+?f2 "/>
            <draw:equation draw:name="f4" draw:formula="top+?f2 "/>
            <draw:equation draw:name="f5" draw:formula="right-?f2 "/>
            <draw:equation draw:name="f6" draw:formula="bottom-?f2 "/>
            <draw:equation draw:name="f7" draw:formula="left+$0 "/>
            <draw:equation draw:name="f8" draw:formula="top+$0 "/>
            <draw:equation draw:name="f9" draw:formula="bottom-$0 "/>
            <draw:equation draw:name="f10" draw:formula="right-$0 "/>
            <draw:handle draw:handle-switched="true" draw:handle-position="$0
top" draw:handle-range-x-minimum="0" draw:handle-range-x-maximum="10800"/>
          </draw:enhanced-geometry>
        </draw:custom-shape>
      </text:p>
    </office:text>
  </office:body>
</office:document-content>
Comment 1 divo76 2009-01-24 15:35:19 UTC
Created attachment 59643 [details]
Document containing picture inside a shape failing to open
Comment 2 michael.ruess 2009-01-26 16:33:38 UTC
MRU->HBRINKM: could you please have a look if this is valid ODF which is
produced by MS Word?
When I create a similar document and save it in MS Word using "SUN ODF Plugin
for MS Word" it can be opened by OOo without any problem.
Comment 3 divo76 2009-01-26 18:58:26 UTC
Just some additional information: 

- The document is valid ODF according to the odftoolkit validator and the ODF
schema allows pictures/frames to be contained in shapes (A drawing object such
as a draw:rect contains draw-text, which can e.g. be a regular paragraph
containing paragraph-content, i.e. this definition is somwhat recursive)

- Word documents with pictures in shapes converted with Sun's ODF Add-in or
OOo's .doc import can be opened because the converter simply drops the image
(after all they are build from the same code base)

- However, both the (only as non-public beta available) MS Word 2007 SP2
converter and the OpenXML/ODF Translator try not to retain the image for full
round-tripability, hence the problem with OOo.
Comment 4 divo76 2009-01-26 19:00:39 UTC
Sorry, should of course the last point should have been:

- However, both the (only as non-public beta available) MS Word 2007 SP2
converter and the OpenXML/ODF Translator try to retain the image for full
round-tripability, hence the problem with OOo.
Comment 5 Mathias_Bauer 2009-05-14 12:37:38 UTC
"Simply ignoring" is a bad idea. The user should at least get a notification
that content couldn't be loaded.

So if I understand correctly you are asking for converting the error into a
warning, right?
Comment 6 openoffice 2009-10-26 15:37:29 UTC
did not manage to fix for OOo 3.2
Comment 7 Rainer Bielefeld 2013-09-17 04:57:47 UTC
<http://odf-validator.rhcloud.com/> rates reporter's sample INVALID (I don't know whether that's related to reported problem), but of course yes, writer should open the document and simply ignore the invalid or unknown parts.

Still Reproducible with reporter's sample document and "AOO 4.1.0-Dev – English  UI / German locale - [AOO410m1(Build:9750)  -  Rev. 1521488 - 2013-09-11]" on German WIN7 Home
Premium (64bit)", own separate user profile.:

1. Try to open sample document from AOO Start Center File menu
   Bug: error message "Read error. Error reading file"

Additional info:
a) Competitors:
a1) SoftMaker FreeOffice: opens document without error message, 
    but frame looks empty
a2) Calligra: opens document, cat with gun picture in frame
a3) LibO 4.0.3: same as AOO
b) OOo 2.0.2 crashes when I try ot open
c) Also error message with 3.1.1
d) I wonder whether that's a feature what will be used often. If yes, this one
   would be a major issue
Comment 8 Marcus 2017-05-20 10:44:16 UTC
Reset the assignee to the default "issues@openoffice.apache.org".