My Line manager has assigned me a new project. It is about linking data from sql server to word documents (eg. employee name from sql server to salary certificate document). She told me to use Office Interop. But I have no knowledge about. How to learn and
do the above project. Could you help me by providing tips, examples,...?
Creation and manipulation of documents using Office COM (Ofice automation) is not recommended, especially in ASP.NET applications. Although Office COM APIs allows for easy document manipulation, it makes
an apllication unstable, unreliable and with Word processes hanged. It must be avoided at all costs and instead
Open XML SDK should be employed in case you want to handcraft the solution.
Open XML SDK requires a lot of work and knowledge to create anything usefull and the solutions are many times unstable and error prone. There are several 3rd party libraries that have similar APIs to Office COM which don't pose the same threaths and weaknesses.
You can also check the Docentric toolkit which uses template-driven aproach for MS Word document generation. It's a perfect solution for your scenario because it will alow you to create templates by using MS Word application
and then process them in your application by using the report engine to generate final documents with mostly only several lines of code.
javedhakim
Member
88 Points
187 Posts
How to learn and do Office Interop programming?
May 22, 2012 03:50 AM|LINK
Hi!
My Line manager has assigned me a new project. It is about linking data from sql server to word documents (eg. employee name from sql server to salary certificate document). She told me to use Office Interop. But I have no knowledge about. How to learn and do the above project. Could you help me by providing tips, examples,...?
Thanks.
ignatandrei
All-Star
135047 Points
21654 Posts
Moderator
MVP
Re: How to learn and do Office Interop programming?
May 22, 2012 04:07 AM|LINK
make a macro in word that does the job.
then, in VS, add a reference to Office and re-make the macro in your preffered language.
javedhakim
Member
88 Points
187 Posts
Re: How to learn and do Office Interop programming?
May 22, 2012 04:20 AM|LINK
I cannot understand you. Could you explain it or at least provide me with links to learn it?
Thanks
Jure.Les
Member
376 Points
69 Posts
Re: How to learn and do Office Interop programming?
May 23, 2012 07:39 AM|LINK
javedhakim,
Creation and manipulation of documents using Office COM (Ofice automation) is not recommended, especially in ASP.NET applications. Although Office COM APIs allows for easy document manipulation, it makes an apllication unstable, unreliable and with Word processes hanged. It must be avoided at all costs and instead Open XML SDK should be employed in case you want to handcraft the solution.
Open XML SDK requires a lot of work and knowledge to create anything usefull and the solutions are many times unstable and error prone. There are several 3rd party libraries that have similar APIs to Office COM which don't pose the same threaths and weaknesses. You can also check the Docentric toolkit which uses template-driven aproach for MS Word document generation. It's a perfect solution for your scenario because it will alow you to create templates by using MS Word application and then process them in your application by using the report engine to generate final documents with mostly only several lines of code.