prepend headers to my csv file

前端 未结 4 473
长发绾君心
长发绾君心 2021-01-29 07:18

I want to prepend headers to my CSV File as to let the data reflect the headings. How would I go about this without having to add it each time writing to the file? Meaning I onl

4条回答
  •  误落风尘
    2021-01-29 08:11

    Got the answer by simply editing my code with this snippet:

     if (!File.Exists(path))
        {
            System.IO.File.WriteAllText(path, rxHeader + textBox8.Text);
        }
        else
        {    
            System.IO.File.AppendAllText(path, textBox8.Text);
            MessageBox.Show("Export  of " + comboBox5.Text + " table is complete!");
            textBox8.Clear();
        }
    

提交回复
热议问题