我正在创建 Excel,如下所示:
class Program
{
private Excel.Application app = null;
private Excel.Application worksheet = null;
private Excel.Application workbook = null;
private Excel.Application worksheet_range = null;
//public Program()
//{
// CreateExcelDoc();
//}
static void Main(string[] args)
{
Program obj = new Program();
obj.CreateExcelDoc();
}
public void CreateExcelDoc()
{
try
{
app = new Excel.Application();
if (app == null)
return;
app.Visible = true;
workbook = app.Workbooks.Add(1);////error in this,saying "can not convert from Excel.Workbook to Excel.Application"
}
catch (Exception ex)
{
throw new Exception("CreateExcelDoc: Error" + ex.Message);
}
}
}
谁能告诉我哪里出错了?注意:我正在关注这个:http: //msdn.microsoft.com/en-us/library/ms173186%28v=vs.80%29.aspx
请给我任何不错的链接/解决方案。我正在使用 Windows 7 64 位操作系统。
谢谢。