我正在使用DataReader将数据写入excelsheet单元格。我没有问题,直到单元格写入previleges。但在一种情况下,只有一个单元是只读的,其余单元是可写的。如何使用DataReader在excel单元格中编写如果特定单元格是使用C#的“ReadOnly”
例如:10 * 10个单元,只有第一个单元是只读的。所以,我会离开这个细胞,并把它写入其余的细胞。但是对于数据读取器,它一次写完整行......所以我如何使用C#实现这一点?
Team Leader (required) , , , , , , , , ,
, , , , , , , , , ,
, , , , , , , , , ,
, , , , , , , , , ,
, , , , , , , , , ,
因此,第一个单元格不应该由datareader写入。 请帮我做这个
if (reader.HasRows)
{
minRow = 0;
minCol = 0;
// Process each result in the result set
while (reader.Read())
{
// Create an array big enough to hold the column values
object[] values = new object[reader.FieldCount];
// Add the array to the ArrayList
rowList.Add(values);
// Get the column values into the array
reader.GetValues(values);
int iValueIndex = 0;
// If the Reading Format is by ColumnByColumn
if (CurTaskNode.ReadFormat == "ColumnbyColumn")
{
minCol = 0;
// minRow = 0;
for (int iCol = 0; iCol < CurTaskNode.HeaderData.Length; iCol++)
{
// Checking whether the Header data exists or not
if (CurTaskNode.HeaderData[minCol] != "")
{
// 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++;
}
minCol++;
}
minRow++;
}
}
}
谢谢 拉姆