cell Data 1 Data 2 Data 3 1. filename blabla.csv 2. Suplier Unknown 3. date 4. batch 12345 5. 6. 7. 8. Data_MI Data_MI_Log Data_WI 9. 31.6227766 1.5 0 10. 31.74680322 1.5017 0 11. .... ... .... 12. .... .... .... ----------------------------------------------------------------
<public datatable="" mode="hold" /> { DataTable tblSource = new DataTable(); tblSource = GetExcelData(); DataTable tblExtract = new DataTable(); DataRow drExtractRow; tblExtract.Columns.Add("Data_MI"); tblExtract.Columns.Add("Data_MI_Log"); tblExtract.Columns.Add("Data_WI"); int intRecCount = 0; foreach (DataRow drSourceRow in tblSource.Rows) { intRecCount = intRecCount + 1; if (intRecCount < 8) { //Lbl_filenamevalue.Text = tblSource.Rows[0]["f2"].ToString().Trim(); Lbl_filenamevalue.Text = HiddenField1.Value; SuplierLabel.Text = tblSource.Rows[1]["f2"].ToString().Trim(); string date = tblSource.Rows[2]["f2"].ToString().Trim(); if (date != null && date != "") { DateTime strdate = Convert.ToDateTime(tblSource.Rows[2]["f2"].ToString().Trim()); DatLabel.Text = strdate.ToString("dd-MMM-yyyy"); } else { DatLabel.Text = DateTime.Now.ToString("dd-MMM-yyyy"); } BatchIDLabel.Text = tblSource.Rows[3]["f2"].ToString().Trim(); } else { drExtractRow = tblExtract.NewRow(); drExtractRow["Data_MI"] = drSourceRow["f1"].ToString() != ""; if (drSourceRow["f2"] != null && drSourceRow["f2"].ToString() != "") { drExtractRow["Data_MI_Log"] = drSourceRow["f2"]; } else { double log_mi = Double.Parse(drSourceRow["f1"].ToString()); double roundoff = Math.Log10(log_mi); drExtractRow["Data_MI_Log"] = Math.Round((decimal)roundoff, 3); } drExtractRow["Data_WI"] = drSourceRow["f3"].ToString() != ""; ; tblExtract.Rows.Add(drExtractRow); } } tblSource.Clear(); return tblExtract; }>
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)