问题描述:

issue: populating values for word document is not happening.object reference error in production server.

development server( working fine)

i am trying to populate the values for the word document using c#.am using microsoft.office.interop.word dll (version 12.0 related to word 2007) as a reference in my project. in my development server office 2007 is installed. am able to populate the values and save the document properly without any error.

Production Environment

getting object reference error. the one difference i see in this server is microsoft word 2010 is installed. i tried my level best but no luck.

*is this because word 2010 is installed in the production server?

*when i hosted the application in the other production server where word 2007 is installed.the application is working fine.

网友答案:

That could be the issue, it looks like Office 2010 uses Version 14 of the dlls: http://www.microsoft.com/en-us/download/details.aspx?id=3508

Maybe try to use the 14 version in your dev server and see if that works, if so should be ok with production as well. otherwise see if the 2007 dll was copied into you bin, if not try to drop the 2007 version (v 12) into you application's bin and see if that works, could be the production application can't locate the dll in your bin and is then looking in the GAC, GAC would have 2010 version installed. If it's in your bin it might use that one first.

相关阅读:
Top