日期:2014-05-18 浏览次数:20493 次
using Excel; Application app = new Application(); if (app == null) { return; } app.Visible = false; app.UserControl = true; Workbooks workbooks = app.Workbooks; _Workbook workbook = workbooks.Add(XlWBATemplate.xlWBATWorksheet Sheets sheets = workbook.Worksheets; _Worksheet worksheet = (_Worksheet)sheets.get_Item(1); if (worksheet == null) { return; } [color=#FF0000] worksheet.get_Range(worksheet.Cells[1, 1], worksheet.Cells[1,3]).Merge(Missing.Value); //横向合并[/color] worksheet.get_Range(worksheet.Cells[1, 1], worksheet.Cells[1, 1]).Value2 = "导出EXCEL测试一";
Excel.Application xlApp = new Excel.Application(); Excel.Workbook workbook = xlApp.Workbooks.Add(true); Excel.Worksheet worksheet = (Excel.Worksheet)workbook.Worksheets[1]; Excel.Range range; Excel.Range range2; range = worksheet.get_Range(xlApp.Cells[1, 1], xlApp.Cells[RowCount + 1, colCount]);
------解决方案--------------------
你是装的Excel2003么?11.0的版本是指2003
------解决方案--------------------
我把应用程序的目标框架改成 .net 2.0
就好了
------解决方案--------------------
哥们我真的很佩服你
------解决方案--------------------
asp.net里面使用 Excel.Application 不是很好