值是一个变量,但用作方法
这里的错误是“范围是一个变量,但用作方法”
我添加了“Microsoft.Office.Interop.Excel”并当前使用它,因为
Microsoft.Office.Interop.Excel.Workbook SelWorkBook = excelappln1.Workbooks.Open(curfile, 0, false, 5, "", "", false,
Microsoft.Office.Interop.Excel.XlPlatform.xlWindows, "", true,
false, 0, false, false, false);
Microsoft.Office.Interop.Excel.Sheets excelSheets = SelWorkBook.Worksheets;
Microsoft.Office.Interop.Excel.Worksheet excelworksheet = (Microsoft.Office.Interop.Excel.Worksheet)excelSheets.get_Item(CurSheetName);
Microsoft.Office.Interop.Excel.Range excelRange = excelworksheet.UsedRange;
object[,] value;
excelRange = excelworksheet.get_Range(CurTaskNode.DATA_MIN_ROW, CurTaskNode.DATA_MIN_COL);
value = (object[,])excelRange.Cells.Value2;
and using the Value to check the cell is locked or not....
if (!value (excelworksheet.Cells[CurTaskNode.DATA_MIN_ROW + minRow, CurTaskNode.DATA_MIN_COL + minCol]).Locked)
{
// Assigning the Value from reader to the particular cell in excel sheet
excelworksheet.Cells[CurTaskNode.DATA_MIN_ROW + minRow, CurTaskNode.DATA_MIN_COL + minCol] = values[iValueIndex];
iValueIndex++;
}
它显示错误 - 值是一个变量,但用作方法。
请帮助我
谢谢拉姆
The error here is "Range is a variable but used as a method"
I added " Microsoft.Office.Interop.Excel" and using it currently as
Microsoft.Office.Interop.Excel.Workbook SelWorkBook = excelappln1.Workbooks.Open(curfile, 0, false, 5, "", "", false,
Microsoft.Office.Interop.Excel.XlPlatform.xlWindows, "", true,
false, 0, false, false, false);
Microsoft.Office.Interop.Excel.Sheets excelSheets = SelWorkBook.Worksheets;
Microsoft.Office.Interop.Excel.Worksheet excelworksheet = (Microsoft.Office.Interop.Excel.Worksheet)excelSheets.get_Item(CurSheetName);
Microsoft.Office.Interop.Excel.Range excelRange = excelworksheet.UsedRange;
object[,] value;
excelRange = excelworksheet.get_Range(CurTaskNode.DATA_MIN_ROW, CurTaskNode.DATA_MIN_COL);
value = (object[,])excelRange.Cells.Value2;
and using the Value to check the cell is locked or not....
if (!value (excelworksheet.Cells[CurTaskNode.DATA_MIN_ROW + minRow, CurTaskNode.DATA_MIN_COL + minCol]).Locked)
{
// Assigning the Value from reader to the particular cell in excel sheet
excelworksheet.Cells[CurTaskNode.DATA_MIN_ROW + minRow, CurTaskNode.DATA_MIN_COL + minCol] = values[iValueIndex];
iValueIndex++;
}
it shows the errror - value is a variable but used like a method..
please help me
Thanks
Ramm
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
问题出在这一行上,
将其更改为:
引发错误是因为您已将 value 声明为二维对象数组,并且在第一行中您尝试使用它是一个方法,即 !value(CellRange).Locked
The problem is on this line
Change it to:
The error is being raised because you have declared value as a 2 dimensional object array and in the first line you are trying to use it is a method i.e. !value(CellRange).Locked