none
It should be possible to embed the excel source file for a mail merge RRS feed

  • Question

  • Hello,

    I tried embedding the excel source file for a mail merge into the DOCX.

    First I looked how Word embeds images: The content type is added to [Content_Types].xml, the image is saved in word/media and it is referenced in word/_rels/document.xml.rels.

    I did the same for my XLSX that provides the source for my mail merge.

    I can savely do all of the above steps that are done for the image, the only difference is that the reference for the mail merge source is defined in word/_rels/settings.xml.rels (instead of document.xml.res).

    But when I try to change the mail merge relationship target from

    <Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"><Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/mailMergeSource" Target="list.xls" TargetMode="External"/>

    to

    <Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"><Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/mailMergeSource" Target="media/list.xls"/>

    I get a syntax error. But not from this relationship, which is perfectly fine, but from the mail merge. To be precise the following line/statement of the word/settings.xml throws the syntax error:

    <w:dataSource r:id="rId1" />

    This syntax error appears as soon as I change the TargetMode of the relationship. So it seems like the mail merge implementation throws an error as soon as the TargetMode is not "External". But why is that? This should/could work perfectly fine and would offer the possibility to save the whole mail merge in one single document.

    You could send this mail merge document per e-mail or save it on the network share or offer a single download on your website and so on...

    Why is this not possible? Or is it possible but  I am doing something wrong?

    Monday, June 20, 2016 10:25 AM

Answers

  • So I spent a little more time verifying this in our code and indeed Word does *not* allow internal relationships on the mail merge source part type. So this will not work.

    Hope this helps,

    Tom

    Tuesday, June 21, 2016 1:59 AM
    Moderator

All replies

  • Hello Gustav

    Thank you for contacting Microsoft Support. One of the Open Specifications team will respond to you shortly to begin working with you.

    Regards


    Tarun Chopra | Escalation Engineer | Open Specifications Support Team

    Monday, June 20, 2016 5:39 PM
  • Hi Gustav,

    The <mailMerge> element uses a dataSource child element which is supposed to point to an external datasource, not embedded content in a part like images in the media parts.

    The relationship should look something like this:

        <Relationship Id="rId2" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/mailMergeSource" Target="file:///C:\cases\mailmergetest.xls" TargetMode="External"/>

    And based on ISO/IEC 29500 17.14.9 dataSource (Data Source File Path), the target is external. So what you're asking is if an internal part can be used as the data source and according to the standard, this isn't the intention.

    Best regards,
    Tom Jebo
    Sr Escalation Engineer
    Microsoft Open Specifications 


    Monday, June 20, 2016 6:00 PM
    Moderator
  • So I spent a little more time verifying this in our code and indeed Word does *not* allow internal relationships on the mail merge source part type. So this will not work.

    Hope this helps,

    Tom

    Tuesday, June 21, 2016 1:59 AM
    Moderator
  • Is there any improvement planned on this? Any way to work around this restriction?

    The solution seems so near to me, just allow an internal Relationship.

    Wednesday, August 31, 2016 9:10 AM
  • Hi Gustav, 

    No, we do not have any plans to add the ability to use an internal part as the target for a dataSource relationship in this scenario. I would recommend following up with a post to the Word developer or IT Pro forums:

    https://social.msdn.microsoft.com/Forums/office/en-US/home?forum=worddev 

    https://social.technet.microsoft.com/Forums/office/en-US/home?forum=word

    since this would represent a new feature request in Word. 

    Best regards,
    Tom Jebo
    Sr Escalation Engineer
    Microsoft Open Specifications

     

    Wednesday, August 31, 2016 4:47 PM
    Moderator