public static void WriteFile(string fName) { CrossSectionDET det = new CrossSectionDET(); det.Id = Guid.NewGuid(); det.Owner = "Dr. Frank N. Furter, ESQ"; ExcelCrossSectionDET excel = new ExcelCrossSectionDET(det); CreateListOfPhonySurveys(det, 4); CreateListOfPhonyElevations(det, 6); CreateListOfPhonySites(det, 4); CreateListOfPhonyInstruments(det, 6); excel.Save(fName); }
public static void ReadFile(string fName) { Console.WriteLine("reading workbook named [{0}]", fName); CrossSectionDET det = new CrossSectionDET(); ExcelCrossSectionDET excel = new ExcelCrossSectionDET(det); excel.Load(fName); ValidationIssues issues = det.ValidationIssues; if (issues.Count > 0) { foreach (ValidationIssue issue in issues) { Console.WriteLine(issue.IssueMessage); } return; } Console.WriteLine("Custom property Name: {0}, Value: {1}", "oncorID", det.Id); Console.WriteLine("Custom property Name: {0}, Value: {1}", "oncorOwner", det.Owner); int count = 1; foreach (var dto in det.Surveys.Values) { Console.WriteLine("Survey Row: {0}, Value: {1}", count++, dto); } count = 1; foreach (var dto in det.Elevations.Values) { Console.WriteLine("Elevation Row: {0}, Value: {1}", count++, dto); } count = 1; foreach (var dto in det.Instruments.Values) { Console.WriteLine("Instruments Row: {0}, Value: {1}", count++, dto); } count = 1; foreach (var dto in det.Sites.Values) { Console.WriteLine("Site Row: {0}, Value: {1}", count++, dto); } Console.WriteLine("Closing workbook named [{0}]", fName); }