0
현재이 table1에 액세스 할 수있는이 C# 코드가 있습니다. 그러나 Var listRowsValue 및 var lr에 문제가 있습니다. 어떻게 출력하고 ListRowsValue에서 1을 빼고 "System._ComObject"를 출력으로 볼 수 없습니까? 어떻게 카운트 끝에 다른 행을 확인하지 ListObject의 크기를 조정할 수 있습니까? 내가으로 변환하고있어ListObject for 루프 내에서 Var 인쇄 및 사용
var listRowsValue = xlWorkBook.Worksheets["Sheet1"].ListObjects["table1"].ListRows;
for (int CurrentRow = 0; CurrentRow < listRowsValue.Count; CurrentRow++)
{
if (xlWorkBook.Worksheets["Sheet1"].ListObjects["table1"].Range[CurrentRow, 2].value == -1)
{
xlSheet.Cells[5, 5] = "YES!";
//lr.Range.Clear();
var lr = listRowsValue[CurrentRow];
Console.WriteLine("CURRENT ROW: " + lr);//Why does this not work?
//MoveEmUpOne();
//How do I resize the total listRowsValue count here so it doesn't check another row at the end?
//EXAMPLE: ListRowsValue = ListRowsValue - 1;
//CurrentRow = CurrentRow - 1;
}
else
{
xlSheet.Cells[5, 5] = "NO!";
}
}
올드 VBA 코드 :이 집중적으로 COM에 의존하기 때문에
For CurrentRow = 1 To Tablesize
If Lo.ListColumns("Column2").DataBodyRange(CurrentRow) = -1 Then
Ros(CurrentRow).Range.Clear
MoveEmUpOne Lo, CurrentRow, Tablesize
Tablesize = Tablesize - 1 'table didn't really get smaller, but number of "real"rows decreased by 1
CurrentRow = CurrentRow - 1 ' check this row again -- stuff from below might need cleard
End If