c#中进行excel编程的疑问
程序在开发环境windows2003,office2003下,正常运行。发布到win98,office2000环境中,提示"未将对象引用设置到对象实例"。
出错函数代码如下,功能是新建一个带抬头的excel文件。
=========================================================================================
Excel.Workbook workbook = excel.Application.Workbooks.Add(Type.Missing);
excel.Cells[1,1]="站码";
excel.Cells[1,2]="站名";
excel.Cells[1,3]="时间";
excel.Cells[1,4]="水位";
excel.Cells[1,5]="流量";
excel.Cells[1,6]="降水量";
workbook.SaveAs(currentTime.ToString("d"),Type.Missing,Type.Missing,Type.Missing,Type.Missing,Type.Missing,Excel.XlSaveAsAccessMode.xlNoChange,Type.Missing,Type.Missing,Type.Missing,Type.Missing,Type.Missing);
workbook.Close(false,Type.Missing,Type.Missing);