开发者

How to include office dll?

I developed an office tool and it works perfectly in my computer. But when i port the code to another computer the code doesn't work. It shows different error message different time. I created an installer and the office.dll, excel.dll and powerpoint.dll was exported with my exe but it doesn't work. My computer has office 2003 but target computer has both of 2007 and 2003.

Now i suspect maybe in the target computer when my application calls any excel function it is served by GAC of that computer rather than exported dll from my computer.

For this, i am interested to refactor the code: this time i will not use any "using" clause to let the OS what to include, rather than i want to write an assembly class which will load the dll from a specific location ( I believe in this way there will no confusion on which of 2007/2开发者_C百科003+from where excel library is included)....

How can i do this ??? Please help.

A sample code I am asking maybe as follows:

using "System.NECESSARY.LIBRARY.TO.IMPORT.DLL"

void main()
{
  [dllImport("office.dll") OTHER_PARTS_GOES_HERE]

  CLASS application= new excel() /* excel class derivess from included office.dll */
}


Update: I have installed Dot-net 4.0 and now the problem is solved :-) Because dotnet 4.0 correctly export all the dll i need and on the target machine only those exported dll are used...So no more hack necessary to this topic.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜