private void CreateHeader(ExcelDoc excel) { int i = 1; foreach (DataColumn column in _dt.Columns) { excel.setValue(1, i, column.ColumnName); i++; } }
public void Create() { var doc = new ExcelDoc(); try { var i = 1; foreach (MileageReport item in _mileageReportList) { if (item.IsFailed) { doc.setValue(i, 1, item.ToString()); i++; } } doc.SetList(2); i = 1; foreach (MileageReport item in _mileageReportList) { if (!item.IsFailed) { doc.setValue(i, 1, item.ToString()); i++; } } doc.Show(); } catch { doc.Dispose(); } }
private void CreateBody(ExcelDoc excel) { int i = 2; foreach (DataRow row in _dt.Rows) { for (int j = 0; j < row.ItemArray.Count(); j++) { if (row.ItemArray[j].ToString() == string.Empty) { continue; } excel.setValue(i, (j + 1), row.ItemArray[j].ToString()); } i++; } }