void OnDataRow(gSheet sheet) { if (!data.Read()) return; // If no data available then exit sheet.BeginRow(curRow); // This is the row we are going to write foreach(KeyValuePair<int,string> m in mapping) // For each mapping value sheet.WriteCell(m.Key, data[m.Value]); // Save it into the Excel sheet.EndRow(); // Data has been exported curRow++; // Next record will be placed in this excel row exportedRecords++; // Increase number of exported records }