пятница, 4 февраля 2011 г.

C# code snipped: Create Excel instance using the dynamic keyword

The code below creates dynamic Excel.Application object without referencing the Excel COM server dll.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;


namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{

dynamic excel = Activator.CreateInstance(Type.GetTypeFromProgID("Excel.Application"));
excel.Visible = true;
Console.Read();

}
}
}

0 коммент.:

Отправить комментарий

 

.NET ate my MOSK;. Powered By Blogger © 2009 Bombeli | Theme Design: ooruc