Good morning I have the following code for the generation of an excel file in c #
int i = 5;
int f = 0;
foreach (DataRow Row in DS.Tables[0].Rows)
{
f = f + 1;
// Asignar los valores de los registros a las celdas
HojaExcel.Cells[i, "A"] = f;
HojaExcel.Cells[i, "B"] = Row.ItemArray[0];
HojaExcel.Cells[i, "C"] = Row.ItemArray[1];
HojaExcel.Cells[i, "D"] = Row.ItemArray[2];
HojaExcel.Cells[i, "E"] = Row.ItemArray[3];
HojaExcel.Cells[i, "F"] = Row.ItemArray[4];
HojaExcel.Cells[i, "G"] = Row.ItemArray[5];
HojaExcel.Cells[i, "H"] = Row.ItemArray[6];
HojaExcel.Cells[i, "I"] = Row.ItemArray[7];
if (Row.ItemArray[7] == "REALIZADO")
{
HojaExcel.Cells[i, "G"] = "0";
}
// Avanzamos una fila
i++;
}
I am trying to do a check based on the last column that I would not know if it is the correct way or not to validate it, but in the end I want that if the data contained in the column I I have typed Done in the G column, enter the number 0.
Thank you in advance for your cooperation.
Cordial greetings.