none
Relative path in word xml should always be relative to the word file itself not the file first opened RRS feed

  • Question

  • Hello,

    we are using Word with mail merge. We want to make it as easy as possible for different users to get and work with this mail merge. So we change the path to the XLSX to a relative path (something like "mail_merge.xlsx" instead of "C:\some_path\mail_merge.xlsx").

    This way we can send the mail merge per email, offer downloads, etc.

    This works fine als long as Word is closed when/before the user opens the DOCX file. But if the user opened (and leaves it open) a different Word file, from a different location, it does not work. The relative path is is interpreted relative to the first (already open) file, not the second (mail merge) file in which the path is defined.

    This looks like a bug to me.

    Is there any chance this is going to be fixed in the future or is there a way to work around this issues? Any help is greatly appreciated! Thanks in advance!

    PS: Another (even better) solution would be to embed the mail merge source into the Word file, but sadly this is not possible either... https://social.msdn.microsoft.com/Forums/de-DE/a7f671c2-f181-4b1a-b5c6-167b123b0daa/it-should-be-possible-to-embed-the-excel-source-file-for-a-mail-merge?forum=os_binaryfile

    Wednesday, August 31, 2016 9:24 AM

Answers

  • Based on my testing and debugging with this, I found that a relative path used in Target attribute for the mailMergeSource type relationship gets added a data source object and then accessed by the Access database engine. The path it chose to resolve the relative name was my user profile documents folder (My Documents). This failed when both the .xlsx file and the document were in some other unique folder (i.e. not the user profile documents folder). Word displays an error dialog from the data access engine saying that "c:\users\tomjebo\documents\names.xlsx" is not found. This was apparently the constructed name with the resolved base. However, if I placed both the xlsx and the docx file that referenced it in the user profile documents folder, it seemed to work just fine. As a matter of fact, placing only the xlsx in the "My Documents" folder works no matter where I put the docx file.

    I'm thinking that it's more related to the data access engine's default path for data sources than Word using the last or first open document path. 

    In any event, I think this is more of a product support question for Word as the standard (ISO 29500) doesn't prescribe how to resolve the base URI for relative *external* path in the Target attribute for a relationship. It does mention how to resolve for internal but not external. 

    Perhaps there is a setting or something for default data access location. Can you post this to the Word IT Pro forum? 

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

    Tom

    Thursday, September 1, 2016 1:23 AM
    Moderator
  • Hi Gustav, 

    Thanks for the explanation and feedback. This represents a feature request in Word and one that I see has been discussed for several years on various forums and blogs. 

    I would recommend bringing this up on the Word forum as I had recommended previously (https://social.technet.microsoft.com/Forums/office/en-US/home?forum=word)

    I would also recommend logging a suggestion on The Word Suggestion Box (https://word.uservoice.com). The suggestion will be read and responded to provided it gets 20 votes or more. 

    Best regards,
    Tom Jebo
    Sr Escalation Engineer
    Microsoft Open Specifications



    Tuesday, September 6, 2016 9:25 PM
    Moderator

All replies

  • Hi Gustav,

    Thank you for this question. One of our engineers will look into this and follow-up soon.

    Thanks,

    Edgar

    Wednesday, August 31, 2016 2:09 PM
    Moderator
  • Hi Gustav, 

    Are you programmatically (or manually) updating the path to the xlsx file in the dataSource relationship target or are you changing this via Word's UI? 

    Best regards,
    Tom Jebo
    Sr Escalation Engineer
    Microsoft Open Specifications



    Wednesday, August 31, 2016 6:31 PM
    Moderator
  • Based on my testing and debugging with this, I found that a relative path used in Target attribute for the mailMergeSource type relationship gets added a data source object and then accessed by the Access database engine. The path it chose to resolve the relative name was my user profile documents folder (My Documents). This failed when both the .xlsx file and the document were in some other unique folder (i.e. not the user profile documents folder). Word displays an error dialog from the data access engine saying that "c:\users\tomjebo\documents\names.xlsx" is not found. This was apparently the constructed name with the resolved base. However, if I placed both the xlsx and the docx file that referenced it in the user profile documents folder, it seemed to work just fine. As a matter of fact, placing only the xlsx in the "My Documents" folder works no matter where I put the docx file.

    I'm thinking that it's more related to the data access engine's default path for data sources than Word using the last or first open document path. 

    In any event, I think this is more of a product support question for Word as the standard (ISO 29500) doesn't prescribe how to resolve the base URI for relative *external* path in the Target attribute for a relationship. It does mention how to resolve for internal but not external. 

    Perhaps there is a setting or something for default data access location. Can you post this to the Word IT Pro forum? 

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

    Tom

    Thursday, September 1, 2016 1:23 AM
    Moderator
  • Hello Tom,

    thanks for your answer! Yes, I change the path to the XLSX file programatically and not with the Word's UI. There are plenty of manuals and scripts online on how to do so. But other than your perceived behaviour, for me it works as long as both files are in the same folder, no matter where (as stated in the online manuals regarding this workaround). But as I said above, only if Word is closed beforehand.

    We want to distribute our mail merge to a wide range of users, so we sadly do not have control over the Word settings, the solution must lie within the docx file.

    All I'm trying to accomplish here is being able to send someone a mail merge (or offer it for download) and make it as easy as possible for the user to use it, preferably as easy as just opening the DOCX file. And all I'm encountering here are problems and dead ends. This is very frustrating for me.

    Do you have any suggestion for me on how to make this whole process more fluent and less likely for the user to experience errors?

    • Edited by Gustav Rek Friday, September 2, 2016 12:40 PM
    Friday, September 2, 2016 7:31 AM
  • Hi Gustav, 

    Thanks for the explanation and feedback. This represents a feature request in Word and one that I see has been discussed for several years on various forums and blogs. 

    I would recommend bringing this up on the Word forum as I had recommended previously (https://social.technet.microsoft.com/Forums/office/en-US/home?forum=word)

    I would also recommend logging a suggestion on The Word Suggestion Box (https://word.uservoice.com). The suggestion will be read and responded to provided it gets 20 votes or more. 

    Best regards,
    Tom Jebo
    Sr Escalation Engineer
    Microsoft Open Specifications



    Tuesday, September 6, 2016 9:25 PM
    Moderator