vb.net 2005下操作excel无法感知属性问题
在vb.net 2005中
Dim nExcel As Microsoft.Office.Interop.Excel.Application
Dim nWorkBooks As Microsoft.Office.Interop.Excel.Workbooks
Dim nWorkBook As Microsoft.Office.Interop.Excel.Workbook
Dim nWorkSheet As Microsoft.Office.Interop.Excel.Worksheet
Dim nRange As Microsoft.Office.Interop.Excel.Range
nExcel = New Microsoft.Office.Interop.Excel.Application()
nWorkBooks = nExcel.Workbooks
nWorkBook = nWorkBooks.Add()
nWorkSheet = CType(nWorkBook.Worksheets(1), Microsoft.Office.Interop.Excel.Worksheet)
'上述语句正确
要对第一个单元格设置格式等
nworksheet.cells(1,1). 之后无法感知相关属性(如字体,数据格式等),从而无法进行设置.
是什么原因???如何更正???
请指教.