C#
if (dt1 != null)
{
foreach (DataRow dr in dt1.Rows)
{
foreach (DataColumn dc in dr.Table.Columns)
{
dataLine = dataLine + dr[dc] + ",";
}
dataLine = dataLine.Substring(0, dataLine.Length - 1);
dataLine = dataLine + "\n";
ws.Cells.Text = dataLine;
//((Range)ws.Cells["1", "A"]).Value2 = dataLine; // set the cell value at a row and column
}
}
jon6 pointsPosted Mar 7, 2006, 2:38 PM EST
Range range = ws.get_Range("A1", Missing.Value);
range.Value2 = "Hello";
note calling this in a loop is slow (due to OLE overhead) - its better to use
Range range = ws.get_Range("A1..A"+CountOfData.ToString(), Missing.Value);
and then loop through the range values setting them..
good hunting