日期:2014-05-18 浏览次数:20922 次
FileStream fs = new FileStream(name, FileMode.Create, FileAccess.Write); StreamWriter sw = new StreamWriter(fs, Encoding.GetEncoding("GB2312")); DataTable dt = ds.Tables["table1"]; DataTable dtname = GetDataSetName(path).Tables["table1"]; string strhead = ""; string tempStr = ""; string nummonth = ""; int count = dtname.Rows.Count; sw.WriteLine("迟到"+"<color='red'>" + "\t" + year + "年" + month + "考勤统计表"); sw.WriteLine("早退" + "\t"); sw.WriteLine("两者都有" + "\t" + "没有记录"); day = GetDay(month, year); for (int i = 1; i <= Convert.ToInt32(day); i++) { if (i > 1) { nummonth += "\t"; } nummonth += i.ToString(); } sw.WriteLine("姓名" + "\t" + nummonth); for (int i = 0; i < count; i++) { string nameo = dtname.Rows[i][0].ToString() + "\t"; string temp = ""; for (int j = 1; j <= Convert.ToInt32(day); j++) { temp += GetTimeOffValue(path, dtname.Rows[i][0].ToString(), j.ToString()).ToString() + "\t"; } sw.WriteLine(nameo + temp); } sw.Close();