Welcome to OpenXML Developer Sign in | Join | Help

Word 2003 modifying relationships.. Why?

Last post 07-21-2008, 1:33 PM by TapeHead. 5 replies.
Sort Posts: Previous Next
  •  11-09-2007, 11:04 AM 2372

    Word 2003 modifying relationships.. Why?

    I have a document that I add an image to via an application using java.  The image displays fine.  However I am running into a really strange problem.  It seems Word (2003) is modifying the document causing the image to be lost.  Here is what I mean.

    In my document I have 2 images rId4 was inserted using Word.  rId8 was inserted via the program.  I open the doc in word and both images are displayed just fine.  However after I close the document without modifying it at all, rId8 is changed to an external reference and lost.  rId4 is OK.

    So prior to opening the document the word/_rels/document.xml.rels contains the following :  
      <?xml version="1.0" encoding="UTF-8" ?>
    - <Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
      <Relationship Id="rId3" Target="webSettings.xml" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/webSettings" />
      <Relationship Id="rId2" Target="settings.xml" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/settings" />
      <Relationship Id="rId1" Target="styles.xml" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles" />
      <Relationship Id="rId6" Target="theme/theme1.xml" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme" />
      <Relationship Id="rId5" Target="fontTable.xml" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/fontTable" />
      <Relationship Id="rId4" Target="media/image1.jpeg" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/image" />
      <Relationship Id="rId7" Target="vbaProject.bin" Type="http://schemas.microsoft.com/office/2006/relationships/vbaProject" />
      <Relationship Id="rId8" Target="media/sig.jpeg" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/image" />
      </Relationships>



    After closing the document.  word/_rels/document.xml.rels contains the following :
      <?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
    - <Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
      <Relationship Id="rId8" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme" Target="theme/theme1.xml" />
      <Relationship Id="rId3" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/settings" Target="settings.xml" />
      <Relationship Id="rId7" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/fontTable" Target="fontTable.xml" />
      <Relationship Id="rId2" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles" Target="styles.xml" />
      <Relationship Id="rId1" Type="http://schemas.microsoft.com/office/2006/relationships/vbaProject" Target="vbaProject.bin" />
      <Relationship Id="rId6" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/image" Target="ooxWord://word/media/sig.jpeg" TargetMode="External" />
      <Relationship Id="rId5" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/image" Target="media/image1.jpeg" />
      <Relationship Id="rId4" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/webSettings" Target="webSettings.xml" />
      </Relationships>

    Notice that the relationships have now been reordered and rId6 (the image in question) is now marked as External.  I don't care if that Word reorders the relationships, but why is it marking the image as external?  I am probably missing something when I add the image to the package but what??  I have tried to set the TargetMode to internal before opening the document which seems to have no effect.  Also the jpeg is also removed from the package.  Has anyone run into this problem before?
  •  11-12-2007, 10:38 PM 2381 in reply to 2372

    Re: Word 2003 modifying relationships.. Why?

    Hi,

    Have you noticed the Target attribute of rId6?

      <Relationship Id="rId6" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/image"

    Target="ooxWord://word/media/sig.jpeg" TargetMode="External" />

    What is ooxWord://word here?

    Sheela

  •  11-13-2007, 10:21 AM 2386 in reply to 2381

    Re: Word 2003 modifying relationships.. Why?

    Hi Sheela,

    Yes,  this is the problem.  I can't figure out why Word is changing the relationship in this manner.  I'm not sure if I am missing some setting or something.  As you noticed the target changed to "External".  All I have to do is open the document and close it in Word without make any change what so ever.  Word changes this relationship to ooxWord://word/....

    The odd thing is that I have another image that was inserted into the document using Word.  This image doesn't change.  Which leads me to believe that I must be missing an entry or something in some XML somewhere. 


    Here are the XML entries from the original document before Word modifies the document.
    This is image that has been inserted by Word:
            <w:pict>
              <v:shape id="_x0000_i1025" type="#_x0000_t75" style="width:6in;height:324pt">
                <v:imagedata r:id="rId4" o:title="" />
              </v:shape>
            </w:pict>

    This is the image inserted by my application:

            <w:pict>
              <v:shape id="_x0000_i1026" type="#_x0000_t75" style="width:206pt;height: 52pt">
                <v:imagedata r:id="rId8" />
              </v:shape>
            </w:pict>

    After opening the file and closing it the only thing that changes in these entries are the ids.  I just can't see what I am missing.

  •  11-15-2007, 3:05 AM 2396 in reply to 2386

    Re: Word 2003 modifying relationships.. Why?

    Hi,

    I feel, there is a problem with the word 2003 editor.

    Try installing latest office update and open your document.

    If the problem still persist, post this to word 2003 specific forum.

    Sheela

  •  12-11-2007, 6:10 PM 2496 in reply to 2386

    Re: Word 2003 modifying relationships.. Why?

    I ran into the same problem, did you happen to find a solution or workaround?


    -- Gauss
  •  07-21-2008, 1:33 PM 3492 in reply to 2372

    Re: Word 2003 modifying relationships.. Why?

    Found the solution to this problem that seems to work for me. 

    The image tag I was inserting was like this:

     <v:imagedata r:id="rId7" />

    Changed it to be :

     <v:imagedata r:id="rId7" o:title="" />

    What the title has to do with this who knows.. But this works.  No more image targets changed to External.  Hope this helps someone else.
View as RSS news feed in XML