We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Update Data (Link) connection string in Word documents

We have a migration coming up and 100's of Microsoft Word (2010-2013) templates (both .doc and .docx) saved with a Data Link Property pointing to the old server.  I need to bulk update these Word documents to use the new database server name.  I can't see that DocIO has ability to do this?

I don't particularly want to manually open 100+ documents and changing the server name manually, leaving open opportunities for mistakes.

In the mean time I will go old school and use OLE to programmatically open these documents in Word, process scan for a dialog form titled "Data Link Properties" and keystroke into it the correct server name and trigger the OK click, then using OLE I save the Word document.

It would be nicer to do this via Syncfussion, then it would be magnitudes faster, faster still if run asynchronously, and can run directly on the file server where often Office isn't installed.

4 Replies

PR Poorani Rajendran Syncfusion Team July 2, 2019 06:04 AM

 Hi Dean,

Thank you for contacting Syncfusion support,

DocIO doesn’t have direct API to change the data link in the Word document. Currently we are checking the feasibility to achieve your requirement in sample level. We will update you more details about this on 4th July, 2019.

At the meantime, could you please share us the below details from your side:
  1. What kind of data source do you want to connect in your Word document ?
  2. Input Word document with old server link.
Based on the above details, we will proceed further on your requirements and will provide you the more details.

Note: If you have any confidential data in your Word document, please replace with some dummy data and provide us the same. We just need your document to achieve your end requirements.

Please let us know if you have any other questions.

Poorani Rajendran

DG Dean Goddard July 4, 2019 01:30 AM

For both templates I'm changing the server name from medbill-sql\shexieserver to mbe-sql\shexieserver.  But each document behaves differently.  The older one shows a Data Link Properties dialog window while the newer one asks for an ODC file.  For the .docx formats, which are just zip files, I found what I needed under the word\settings.xml, tag.  And changing the DataSource value to mbe-sql\shexieserver.

I don't know how the information is stored in the .doc format, but I assume it's also a  Database Connection string.  If that's the case, then Syncfusion can expose it as a string property called DatabaseConnectionString, and the developer can use a SqlConnectionStringBuilder to populate it for example.  I assume it's not always a "SQL" connection string, but I'm not aware of a generic "ConnectionStringBuilder".

Attachment: Templates_c57cccf2.zip

PR Poorani Rajendran Syncfusion Team July 4, 2019 06:27 AM

Hi Dean,

Thank you for providing the details.

Currently we are validating the requested feature using the given details and we will update you the complete details about this feature on 8th July, 2019.

Please let us know if you have any other questions. 
Poorani Rajendran 

MJ Mohanaselvam Jothi Syncfusion Team July 8, 2019 08:30 AM

Hi Dean,

Thank you for your patience.

Currently, we have planned to expose an API to change the data source path of database in DOCX format Word document only.
Due to our priority on DOCX file format specific features, we are unable to consider this request for DOC file format at this time. So, we recommend you use the DOCX file format to achieve your requirement.

We will implement this API to achieve your requirement in DOCX format and it will be included in our 2019 Volume 3 release which is expected to be available on August 2019.

Please let us know if you have any other questions.

Mohanaselvam J

Live Chat Icon For mobile
Up arrow icon