Word Mail Merge - How to merge through Javascript?
What I will describe here will work only on Internet Explorer. Because it is using an ActiveXObject which is not available in other browsers other than IE.
I know just one way to make Word Mail Merge to work cross browser and that is to implement this in code behind in C#, you can find an article about that on Microsoft's support page: http://support.microsoft.com/kb/301659.
I will probably also make a C# version of my own, if I have a good solution I will post it on the blog.
Here is a Javascript function that I have written for Javascript Word Mail Merge.
This function will merge the Label Template document with the datasource file.
The paths here are not passed by parameters because this is just an example or an idea, for you to have an working example and to know from where to start.
The datasource will look like this:
Note that the delimiter is comma - "," this is why if you will need to have comma inside a label value you will need to put that value inside double quotes like this: "My Te,st Value For extremedev, with comma inside".
The resource that helped me a lot when creating the above function is: http://msdn.microsoft.com/en-us/library/ms254954(v=Office.11).aspx
It helped me a lot because I was not blind when implementing it because I at least knew what methods and parameters exists. The link that I gave above does not contain a Javascript description for methods and parameters, but there are VB explanations and examples.
If you have some ideas or suggestions for Word Mail Merge then do not hesitate to leave a comment - this will help others.
2 comments:
Hi..
How to do a many to one relationship in datasource.
Consider datasource has below columns.
col1, col2, col3:N
Where col3:N is the multivalue column.
How to write data for col3:N? How the datasource should look like?
Thanks in advance,
BNL
Hi BNL,
Sorry but it was long time ago, and I haven't been working with that a long time.
Can not help you.
Regards,
Roman
Post a Comment
your thoughts are welcome: