I have the code below to iterate through an Excel file to convert it to a pipe delimited file.
for (rCnt = 1; rCnt <= range.Rows.Count; rCnt++)
{
for (cCnt = 1; cCnt <= range.Columns.Count; cCnt++)
{
str = str +"|"+ (string)(range.Cells[rCnt, cCnt] as Excel.Range).Value2;
}
sw.WriteLine(str);
str = "";
}
Problem is that when I get to a numerical value I get a runtime error "Can't convert double to string"
Any ideas how I can write a double value from Excel to file using StreamWriter?