Jump to content

Check out our Community Blogs

Register and join over 40,000 other developers!

Recent Status Updates

View All Updates

- - - - -

Dynamically loading an assembly


  • Please log in to reply
1 reply to this topic

#1 mayasmitha


    CC Newcomer

  • Member
  • PipPip
  • 14 posts

Posted 26 September 2012 - 08:26 PM

I need to dynamically load an assembly. Currently I am working with "Microsoft.Office.Microsoft.Office.Interop.dll". I need to open an excel file and get the sheets and data out of it. Can anyone tell me how can I do it?

Assembly SampleAssembly = Assembly.Load
("Microsoft.Office.Interop.Excel, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c");

if (SampleAssembly != null)
Type type = SampleAssembly.GetType("Microsoft.Office.Interop.Excel.ApplicationClass");
Object AppClass = Activator.CreateInstance(type);

[b]How will I get ApplicationClass object and Workbooks objects here?[/b]

  • 0

#2 BlackRabbit


    CodeCall Legend

  • Expert Member
  • PipPipPipPipPipPipPipPip
  • 3871 posts
  • Location:Argentina
  • Programming Language:C, C++, C#, PHP, JavaScript, Transact-SQL, Bash, Others
  • Learning:Java, Others

Posted 26 September 2012 - 10:23 PM

you just need to object-browse the office and excel namespace :D

you can open the woorkboos like this :

       	 Excel.Application oXL = new Excel.Application();
            Excel.Workbook theWorkbook;

There is also tutorials here in the tuts section about how to read and handle office documents without using the interop
  • 0

Also tagged with one or more of these keywords: assembly

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download