Last post May 23, 2012 08:39 AM by Jure.Les
May 22, 2012 04:50 AM|javedhakim|LINK
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,...?
May 22, 2012 05:07 AM|ignatandrei|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.
May 22, 2012 05:20 AM|javedhakim|LINK
I cannot understand you. Could you explain it or at least provide me with links to learn it?
May 23, 2012 08:39 AM|Jure.Les|LINK
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.