The log is exported to a simple instance of the txt text in C
- 2020-05-19 05:39:34
- OfStack
/// <summary>
/// Call log
/// </summary>
/// <param name="log"></param>
// First of all, again using system.io;
public void Write(ArrayList log)
{
// Save the file on your desktop with a file name called the current time .txt
FileStream fs = new
FileStream("C:\\Users\\ailin\\Desktop\\" +
DateTime.Now.ToLongTimeString().Replace(":", "") + ".txt", FileMode.OpenOrCreate, FileAccess.ReadWrite);
StreamWriter sw = new StreamWriter(fs, Encoding.Default);
foreach( string i in log)
{
sw.Write(i.ToString());
}
DateTime dt1 = DateTime.Now;
sw.WriteLine();
sw.WriteLine(" Operation: cxx");
sw.WriteLine(" Date: "+Convert.ToString(dt1));
sw.Flush();
sw.Close();
}
//string sSaveExcelName =
//"C:\\" + DateTime.Now.ToShortDateString().Replace("-", "") + DateTime.Now.ToLongTimeString().Replace(":", "") + ".xls";
public static ArrayList aChg_Slab_Len = new ArrayList();
private void button2_Click(object sender, EventArgs e)
{
ArrayList cx = new ArrayList();
for (int i = 0; i < ss1.ActiveSheet.RowCount; i++)
{
for (int j = 0; j < ss1.ActiveSheet.ColumnCount; j++)
{
cx.Add(ss1.ActiveSheet.Cells[i, j].Text);
cx.Add(" ");
}
cx.Add("\r\n");
}
// Perform the operation of exporting the log
Write(cx);
return;
}