Note that there are some explanatory texts on larger screens.

plurals
  1. POhow to write in excel cells using DataReader if a particular cell is "ReadOnly" using C#
    primarykey
    data
    text
    <p>I am using DataReader to write data into excelsheet cells. I have no problem until the cell has write previleges. But in one case, only one cell is readonly and the rest cells are writable. </p> <p>Eg : 10 * 10 cells, only first cell is readonly. so, i shuld leave this cell and write it to rest of the cells. But with the data reader it writes entire row at one go.. so how can i acheive this using C# ?</p> <pre><code>Team Leader (required) , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , </code></pre> <p>so, the first cell shouldn't be written by datareader. Please help me in doing this </p> <pre><code>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 &lt; 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++; } } } </code></pre> <p>Thank you, Ramm</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload