public Dictionary <int, Clazz> GetExcelTitleToClazzMap(string path, string mapFile, int titleIndex, string classForName) { IWorkbook workbook = ExcelRead.ReadExcel(path); ISheet sheetAt = workbook.GetSheetAt(0); return(this.GetExcelTitleToClazzMap(sheetAt, mapFile, titleIndex, classForName)); }
public IList <JSYD> GetJSYDByZJDDataSourceViewModel(ZJDDataSourceViewModel model) { ObservableCollection <ZJDXZDM> zjdXZDM = ZJDXZDMCustom.GetExcelToZJDXZDM(model.ZJDXZDMTablePath); ObservableCollection <JTCY> hzs = JTCYCustom.GetExcelToHZS(model.JTCYTablePath); //户主必须要先检查 zjdDao.ChecSFZ(hzs, model); ObservableCollection <JSYD> jsyds = JSYDCustom.GetExcelToJSYDS(model.JSYDTablePath); IWorkbook workbook = ExcelRead.ReadExcel(model.NFTablePath); ObservableCollection <NF> nfs = NFCustom.GetExcelToNFS(workbook.GetSheetAt(0)); ObservableCollection <Floor> floors = FloorCustom.GetExcelToFloors(workbook.GetSheetAt(1)); ObservableCollection <Zdinfo> zdinfos = ZdinfoCustom.GetMDBToZdinfos(model.ZdinfoMDBPath); Dictionary <string, JSYD> jsydDic = MyUtils.Utils.GetGroupDic("ZDNUM", jsyds); JSYDCustom.SetZdinfo(jsydDic, zdinfos); ObservableCollection <JSYD> gyrs = JSYDCustom.GetExcelToGYRS(model.JSYDTablePath); JSYDCustom.SetHZs(jsyds, gyrs, hzs); JSYDCustom.SetNF(jsydDic, nfs); JSYDCustom.SetFloor(jsydDic, floors); JSYDCustom.SetZJDXZDM(jsydDic, zjdXZDM); ObservableCollection <QZB> qzbs = QZBCustom.GetMDBToQZB(model.QZ_BSMDBPath); JSYDCustom.SetQZBs(jsyds, qzbs); ObservableCollection <JZXInfo> jzxs = JZXInfoCustom.GetMDBToJZX(model.QZ_BSMDBPath); JSYDCustom.SetJZXs(jsyds, jzxs); return(jsyds); }
public void WhenUserClicksOnAnyOfTheAccountListed() { try { List <IWebElement> rows = new List <IWebElement>(AccountsPage.TableElement(SelectBrowser.driver).FindElements(By.TagName("tr"))); rowscount = rows.Count; List <IWebElement> columns = new List <IWebElement>(SelectBrowser.driver.FindElements(By.XPath("//table[@id='accounts-jeopardy']//tbody//tr[1]/td"))); colcount = columns.Count; for (int rownum = 1; rownum <= rowscount - 2; rownum++) { List <IWebElement> rowCells = new List <IWebElement>(SelectBrowser.driver.FindElements(By.XPath("//table[@id='accounts-jeopardy']//tbody//tr[" + rownum + "]/td"))); for (int CellNumber = 0; CellNumber < rowCells.Count; CellNumber++) { string text = rowCells.ElementAt(CellNumber).Text; IWebElement element = rowCells.ElementAt(CellNumber).FindElement(By.TagName("a")); string textpresent = element.Text; if (textpresent.Contains(ExcelRead.GetCellData(xlpath1, @"AccountsSheet", 1, 0))) { Synchronization.VisibleElement(SelectBrowser.driver, By.TagName("a")); element.Click(); test.Log(Status.Pass, "Clicked on the Account==>" + ExcelRead.GetCellData(xlpath1, @"AccountsSheet", 1, 0)); break; } } break; } } catch (Exception ex) { Console.WriteLine("Exception==>" + ex); ScreenshotPage.TakesScreenshotWithDate(@"Screesnhot", System.Drawing.Imaging.ImageFormat.Png); } }
internal Dictionary <int, Clazz> ConfigNameToClazzMap(string configNamePath, int sheetIndex, string classFullName) { Dictionary <string, string> dic = ExcelRead.FileConfigToDic(configNamePath, sheetIndex); Dictionary <int, string> functionMap = Utils.DicToInt(dic); return(this.GetExcelToClazzMap(functionMap, classFullName)); }
public static void ExportJTCYTable(IList <JTCY> hzs, string saveDirPath) { Dictionary <int, XMLTable> xmlJtcyDkDic = XMLRead.GetXmlToXMLTabl("Model/JTCY.Excel.hbm.xml"); XMLTable xmlTable = xmlJtcyDkDic[0]; IWorkbook workbook = ExcelRead.ReadExcel("ChengDuGaoXingZaiJiDiModel/家庭成员表模板.xls"); ISheet sheet = workbook.GetSheetAt(0); List <JTCY> jtcys = new List <JTCY>(); foreach (JTCY hz in hzs) { jtcys.AddRange(hz.JTCies); } ExcelWrite.WriteObjects(sheet, xmlTable, jtcys); //合并户主的单元格 int rowIndex = xmlTable.RowStartIndex; foreach (JTCY hz in hzs) { ExcelWrite.SetValue(sheet.GetRow(rowIndex), 0, rowIndex - 4 + ""); ExcelWrite.SetValue(sheet.GetRow(rowIndex), 1, hz.XM); int lastRow = rowIndex + hz.JTCies.Count; sheet.AddMergedRegion(new CellRangeAddress(rowIndex, lastRow - 1, 0, 0)); sheet.AddMergedRegion(new CellRangeAddress(rowIndex, lastRow - 1, 1, 1)); rowIndex = lastRow; } ExcelWrite.Save(workbook, saveDirPath + "\\家庭成员表.xls"); }
public async Task <IActionResult> LocalizarCEP(IFormFile file) { //Start Bot ExcelRead.ReadExcel(file); return(Ok("Seu Arquivo será processado.")); }
/// <summary> /// /// </summary> /// <param name="path"></param> /// <param name="sheetIndex"></param> /// <param name="TitelRowIndex"></param> /// <param name="EndRowIndex">此行要读取,默认是最后一行</param> public ExcelReflectModel(string excelPath, string path, int sheetIndex = 0, int TitelRowIndex = 0, int StartRowIndex = 1, int EndRowIndex = -1) { if (!Utils.CheckFileExists(excelPath)) { throw new Exception("文件不存在:" + excelPath); } if (!Utils.CheckFileExists(path)) { throw new Exception("文件不存在:" + path); } Sheet = ExcelRead.ReadExcelSheet(excelPath, sheetIndex); this.PropertDic = XMLRead.GetConfigXmlDic(path, "property", "name", "column"); //this.TitelRowIndex = TitelRowIndex; this.ClazzDic = ReflectUtils.MethodToFunction <T>(); this.TitleDic = GetTitleDic(Sheet.GetRow(TitelRowIndex), this.PropertDic, this.ClazzDic); if (EndRowIndex == -1) { this.LastRowIndex = Sheet.LastRowNum; } else { this.LastRowIndex = EndRowIndex; } this.StartRowIndex = StartRowIndex; }
public static void ExportJSYDTable(IList <JSYD> jsyds, string saveDirPath) { string jsydExcelPath = "ChengDuGaoXingZaiJiDiModel/建设用地表共用宗模板.xls"; Dictionary <int, XMLTable> xmlJtcyDkDic = XMLRead.GetXmlToXMLTabl("Model/JSYD.Excel.hbm.xml"); IWorkbook workbook = ExcelRead.ReadExcel(jsydExcelPath); ISheet sheet = workbook.GetSheetAt(0); ExcelWrite.WriteObjects <JSYD>(sheet, xmlJtcyDkDic[0], jsyds); ExcelWrite.Save(workbook, saveDirPath + "\\建设用地表.xls"); }
/// <summary> /// tidy analog quantity parameters /// </summary> private static void TidyAnalogQuantityParameters(string filePath, OutputInfo outputInfo) { _dt = ExcelRead.ReadExcel(filePath, "analog quantity"); if (_dt == null) { return; } TidyAnalogQuantityParameters(_dt, outputInfo); }
/// <summary> /// tidy switching value parameters /// </summary> private static void TidySwitchingValueParameters(string filePath, OutputInfo outputInfo) { _dt = ExcelRead.ReadExcel(filePath, "switching value"); if (_dt == null) { return; } TidySwitchingValueParameters(_dt, outputInfo); }
public LessonsViewModel() { UrlFile Url = JsonConvert.DeserializeObject <UrlFile>(File.ReadAllText("JsonUrl/Url.json")); _Read = new ExcelRead(Url.LessonsUrl, 1); ListInfo = new ObservableCollection <Lessons>(); for (int i = 1; i <= 11; i++) { LoadLes(i); } _Read.CloseActin(); }
public void ThenUserShouldBeNavigatesToTheCorrectPage() { try { string texttitle = SelectBrowser.driver.Url; Assert.IsTrue(texttitle.Contains(ExcelRead.GetCellData(xlpath1, @"AccountsSheet", 1, 0))); test.Log(Status.Pass, "User Navigated to the Specfic Account Page"); } catch (Exception ex) { Console.WriteLine("Exception==>" + ex); ScreenshotPage.TakesScreenshotWithDate(@"Screesnhot", System.Drawing.Imaging.ImageFormat.Png); } }
public void WhenEnterUsernameAndPassword() { try { LoginPage.UsernameText(SelectBrowser.driver).SendKeys(ExcelRead.GetCellData(xlpath1, @"UserCredentials", 1, 0)); LoginPage.PasswordText(SelectBrowser.driver).SendKeys(ExcelRead.GetCellData(xlpath1, @"UserCredentials", 1, 1)); test.Log(Status.Pass, "Enter Username and Password"); } catch (Exception ex) { Console.WriteLine("Exception==>" + ex); ScreenshotPage.TakesScreenshotWithDate(@"Screesnhot", System.Drawing.Imaging.ImageFormat.Png); } }
public static ExcelRead ConvertXSLXtoDataTable(string strFilePath, string connString) { OleDbConnection oledbConn = new OleDbConnection(connString); DataTable dt = new DataTable(); DataSet ds = new DataSet(); ExcelRead ExcelRead = new ExcelRead(); ExcelRead.Name = Path.GetFileName(strFilePath); ExcelRead.excelContent = new List <ExcelContent>(); try { oledbConn.Open(); using (DataTable Sheets = oledbConn.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, null)) { for (int i = 0; i < Sheets.Rows.Count; i++) { string worksheets = Sheets.Rows[i]["TABLE_NAME"].ToString(); OleDbCommand cmd = new OleDbCommand(String.Format("SELECT * FROM [{0}]", worksheets), oledbConn); OleDbDataAdapter oleda = new OleDbDataAdapter(); oleda.SelectCommand = cmd; oleda.Fill(ds); } dt = ds.Tables[0]; } } catch (Exception ex) { } finally { oledbConn.Close(); } foreach (DataRow dr in dt.Rows) { ExcelRead.excelContent.Add(new ExcelContent() { Category = dr[0].ToString(), Question = dr[1].ToString(), Positive = dr[2].ToString(), Type = dr[3].ToString(), Option = dr[4].ToString(), Value = dr[5].ToString() }); } return(ExcelRead); }
public static ExcelRead ConvertCSVtoDataTable(string strFilePath) { DataTable dt = new DataTable(); ExcelRead ExcelRead = new ExcelRead(); ExcelRead.Name = Path.GetFileName(strFilePath); ExcelRead.excelContent = new List <ExcelContent>(); using (StreamReader sr = new StreamReader(strFilePath)) { string[] headers = sr.ReadLine().Split(','); foreach (string header in headers) { dt.Columns.Add(header); } while (!sr.EndOfStream) { string[] rows = sr.ReadLine().Split(','); if (rows.Length > 1) { DataRow dr = dt.NewRow(); for (int i = 0; i < headers.Length; i++) { dr[i] = rows[i].Trim(); } dt.Rows.Add(dr); } } } foreach (DataRow dr in dt.Rows) { ExcelRead.excelContent.Add(new ExcelContent() { Category = dr[0].ToString(), Question = dr[1].ToString(), Positive = dr[2].ToString(), Type = dr[3].ToString(), Option = dr[4].ToString(), Value = dr[5].ToString() }); } return(ExcelRead); }
public void ExportCun_GongShi(IList <JTSYQ> jtsyqs, XZDM xzdm, string dir) { Dictionary <int, XMLTable> ClazzDic = XMLRead.GetXmlToXMLTabl(JTSYQCustom.Cun_GongGao_Reflect); XMLTable xmlTable = ClazzDic[1]; IWorkbook workbook = ExcelRead.ReadExcel(JTSYQCustom.Cun_GongShi); ISheet sheet = workbook.GetSheetAt(0); //文字替换 Dictionary <string, XMLObject> xmlobjectDic = XMLRead.XmlToObjects(JTSYQCustom.FanKuiYiJianShuXMLRelfect, false); xzdm.JTSYQ_DasTatal = (xzdm.JTSYQ_GSEndTime - xzdm.JTSYQ_GSStartTime).Days; ExcelWrite.ReplaceTextByXMLObject(sheet, xzdm, xmlobjectDic); //行数据插入 ExcelWrite.WriteObjects(sheet, xmlTable, jtsyqs); ExcelWrite.Save(workbook, dir + "//" + System.IO.Path.GetFileName(JTSYQCustom.Cun_GongShi)); }
private void ComboboxSave() { XmlRead read = new XmlRead(); int result = 0; try { int num2; read.Delete(FileName.File1); int.TryParse(this.txt_1.Text, out result); result--; if (result < 0) { result = 0; } DataTable table = ExcelRead.ExcelToDataTable(this.file_1.get_TextBoxFile().Text, this.com_sheet_1.Text.Trim() + "$", 0); for (num2 = 0; num2 < table.Columns.Count; num2++) { int num3 = num2 + 1; read.File1AppendChild("1." + num3.ToString(), table.Rows[Convert.ToInt32(result)][num2].ToString()); } read.Delete(FileName.File2); int.TryParse(this.txt_2.Text, out result); result--; if (result < 0) { result = 0; } if (File.Exists(this.file_2.get_TextBoxFile().Text.Trim())) { DataTable table2 = ExcelRead.ExcelToDataTable(this.file_2.get_TextBoxFile().Text, this.com_sheet_2.Text.Trim() + "$", 0); for (num2 = 0; num2 < table2.Columns.Count; num2++) { read.File2AppendChild("2." + ((num2 + 1)).ToString(), table.Rows[Convert.ToInt32(result)][num2].ToString()); } } Regex regex = new Regex(@"^\[\d+\]"); read.SetKey1(regex.Replace(this.combo_1.Text.Trim(), string.Empty)); read.SetKey2(regex.Replace(this.combo_2.Text.Trim(), string.Empty)); } catch (Exception exception) { MessageBoxHelper.Show(exception.ToString(), "异常"); } }
public void ExportCun_JiTiTuDiDiaoChaBiao(IList <JTSYQ> jtsyqs, string saveDir) { Dictionary <int, XMLTable> ClazzDic = XMLRead.GetXmlToXMLTabl(JTSYQCustom.JiTiTuDiDiaoChaBiao_Reflect); foreach (JTSYQ jtsyq in jtsyqs) { jtsyq.XZDM = XZDMCustom.GetXzdm(XZDMCustom.JTSYQBianMaToXZDM(jtsyq.BM)); // JTSYQCustom.SetContainsFeatureArea(jtsyq); } XMLTable xmlTable = ClazzDic[1]; IWorkbook workbook = ExcelRead.ReadExcel(JTSYQCustom.JiTiTuDiDiaoChaBiao); ISheet sheet = workbook.GetSheetAt(0); //行数据插入 ExcelWrite.WriteObjects(sheet, xmlTable, jtsyqs); ExcelWrite.Save(workbook, saveDir + "//" + System.IO.Path.GetFileName(JTSYQCustom.JiTiTuDiDiaoChaBiao)); }
private void comboboxBind() { this.combobox.Items.Clear(); int result = 0; try { int num2; int.TryParse(this.txt_1.Text, out result); result--; if (result < 0) { result = 0; } DataTable table = new DataTable(); if (File.Exists(this.file_1.get_TextBoxFile().Text)) { table = ExcelRead.ExcelToDataTable(this.file_1.get_TextBoxFile().Text, this.com_sheet_1.Text.Trim() + "$", 0); for (num2 = 1; num2 <= table.Columns.Count; num2++) { this.combobox.Items.Add("1." + num2); } this.combobox.Items.Add("----------------------"); result = 0; int.TryParse(this.txt_2.Text, out result); result--; if (result < 0) { result = 0; } } if (this.radioButton2.Checked && File.Exists(this.file_2.get_TextBoxFile().Text)) { DataTable table2 = ExcelRead.ExcelToDataTable(this.file_2.get_TextBoxFile().Text, this.com_sheet_2.Text.Trim() + "$", 0); for (num2 = 1; num2 <= table2.Columns.Count; num2++) { this.combobox.Items.Add("2." + num2); } } } catch { } }
public ExcelJsonModel(string excelPath, int TitelRowIndex = 0, int StartRowIndex = 1, int LastRowIndex = -1, int sheetIndex = 0) { if (!Utils.CheckFileExists(excelPath)) { throw new Exception("文件不存在:" + excelPath); } Sheet = ExcelRead.ReadExcelSheet(excelPath, sheetIndex); if (LastRowIndex == -1) { this.LastRowIndex = Sheet.LastRowNum; } else { this.LastRowIndex = LastRowIndex; } this.TitelRowIndex = TitelRowIndex; this.StartRowIndex = StartRowIndex; }
public Dictionary <int, Clazz> GetExcelTitleToClazzMap(ISheet sheet, string mapFile, int titleIndex, string classForName) { Dictionary <string, int> titleList = this.getTitleList(sheet.GetRow(titleIndex)); Dictionary <int, Clazz> result; if (titleList == null) { result = null; } else { Dictionary <string, string> map = ExcelRead.ReadExcelToDic(mapFile, 0); Dictionary <int, string> functionMap = this.MapToMapKeyToValue(titleList, map); Dictionary <string, Clazz> methodMap = ReExcelUtils.MethodToLowerFunction(classForName); Dictionary <int, Clazz> dictionary = this.MapToMapKeyToValue(functionMap, methodMap); result = dictionary; } return(result); }
/// <summary> /// 代码关系转换 为文字关系 /// </summary> /// <param name="hzs"></param> private static void DMToText(IList <JTCY> hzs) { int value; Dictionary <string, string> yhzgxDic = ExcelRead.ReadExcelToDic(System.AppDomain.CurrentDomain.BaseDirectory + "家庭关系代码.xls", 0); foreach (JTCY hz in hzs) { foreach (JTCY jtcy in hz.jTCies) { string sex = jtcy.XB; if (sex != null) { if (int.TryParse(sex, out value)) { if (value % 2 == 0) { jtcy.XB = "男"; } else { jtcy.XB = "女"; } } } string yhzgx = jtcy.YHZGX; if (!Utils.IsStrNull(yhzgx) && yhzgxDic.TryGetValue(yhzgx, out yhzgx)) { jtcy.YHZGX = yhzgx; } string sfgyr = jtcy.SFGYR; if (sfgyr == "1" || sfgyr == "是") { jtcy.SFGYR = "是"; } else { jtcy.SFGYR = "否"; } } } }
private void btnimport_Click(object sender, EventArgs e) { string oldPath = Directory.GetCurrentDirectory(); OpenFileDialog of = new OpenFileDialog(); of.ShowDialog(); string strPathName = of.FileName; Directory.SetCurrentDirectory(oldPath); DataTable dt = ExcelRead.getSheet(strPathName, "sheet1"); for (int i = 0; i < dt.Rows.Count; i++) { TheLoaiDTO tl = new TheLoaiDTO(); tl.TenTheLoai = dt.Rows[i].ItemArray[1].ToString(); TheLoaiDAO.Insert(tl); } MessageBox.Show("Import dữ liệu thành công ...", "Thông báo"); HienThiDanhSach(); }
public IActionResult MetaData(string file) { // Extract file name from whatever was posted by browser var fileName = file; ViewBag.Message = "View Meta-data Definition for Current File: " + fileName; ExcelRead er = new ExcelRead(fileName); er.GetExcel(file); string one = "The name of the first worksheet in this workbook is: " + er.getNameOfSheet(); //string two = er.ReadCell(1, 1); //ViewBag.ReadCell = two; return(View()); }
/// <summary> /// 导出农房表 /// </summary> /// <param name="nfs"></param> /// <param name="saveDirPath"></param> public static void ExportNFTable(IList <NF> nfs, string saveDirPath) { List <NF> allNF = new List <NF>(); List <Floor> allFloor = new List <Floor>(); foreach (NF nf in nfs) { //allNF.AddRange(nf.NFS); //allFloor.AddRange(nf.Floors); } Dictionary <int, XMLTable> xmlJtcyDkDic = XMLRead.GetXmlToXMLTabl("Model/NF.Excel.hbm.xml"); XMLTable xmlTable = xmlJtcyDkDic[0]; IWorkbook workbook = ExcelRead.ReadExcel("ChengDuGaoXingZaiJiDiModel/农房表模板.xls"); ISheet sheet = workbook.GetSheetAt(0); ExcelWrite.WriteObjects(sheet, xmlTable, allNF); //导出分层表 ExcelWrite.WriteObjects(workbook.GetSheetAt(1), XMLRead.GetXmlToXMLTabl("Model/Floor.Excel.hbm.xml")[0], allFloor); ExcelWrite.Save(workbook, saveDirPath + "\\农房表.xls"); }
static void Main(string[] args) { // The code provided will print ‘Hello World’ to the console. // Press Ctrl+F5 (or go to Debug > Start Without Debugging) to run your app. String path = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); List <String> arr = new List <string>(); arr = ExcelRead.ReadExcel(path + "\\Testdata.Xlsx", 1); foreach (String item in arr) { Console.WriteLine(item); } // Console.Read(); Console.WriteLine(System.IO.Directory.GetCurrentDirectory()); Console.ReadKey(); // Go to http://aka.ms/dotnet-get-started-console to continue learning how to build a console app! }
private void ExcelSheetBindComBoBoxItems(AisinoCMB bobox, string path) { try { bobox.Items.Clear(); if (!File.Exists(path)) { MessageBoxHelper.Show(path + "文件不存在!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } else { DataTable excelTableNames = ExcelRead.GetExcelTableNames(path); bobox.Text = excelTableNames.Rows[0][2].ToString().Trim(new char[] { '$' }); for (int i = 0; i < excelTableNames.Rows.Count; i++) { string str = excelTableNames.Rows[i][2].ToString().Trim(); int num2 = 0; if (str[str.Length - 1] != '$') { num2 = 1; } for (int j = 0; j < bobox.Items.Count; j++) { if (bobox.Items[j].ToString() == str) { num2 = 1; } } if (num2 == 0) { bobox.Items.Add(str.Trim(new char[] { '$' })); } } } } catch (Exception exception) { MessageBoxHelper.Show(exception.ToString(), "异常"); } }
public void ThenUserCanCompareColumnOfDownloadedXlsxFile() { string pendRenDownXlpath = @"C:\Users\Anuruddha.Tiwari\Downloads\quadrantThree.xlsx"; try { string s1 = ActivityHomePage.BillingNameHeader(SelectBrowser.driver).Text; Assert.IsTrue(ExcelRead.GetCellData(pendRenDownXlpath, @"Pending Renewals", 0, 0).Contains(s1)); test.Info("Assert pass successfully for compare the 1st column header with respect to present header under Pending Renewals"); string s2 = ActivityHomePage.PubCodeHeader(SelectBrowser.driver).Text; Assert.IsTrue(ExcelRead.GetCellData(pendRenDownXlpath, @"Pending Renewals", 0, 1).Contains(s2)); test.Info("Assert pass successfully for compare the 2nd column header with respect to present header under Pending Renewals"); string s3 = ActivityHomePage.ContractEndHeader(SelectBrowser.driver).Text; Assert.IsTrue(ExcelRead.GetCellData(pendRenDownXlpath, @"Pending Renewals", 0, 2).Contains(s3)); test.Info("Assert pass successfully for compare the 3rd column header with respect to present header under Pending Renewals"); string s4 = ActivityHomePage.ContractAmountHeader(SelectBrowser.driver).Text; Assert.IsTrue(ExcelRead.GetCellData(pendRenDownXlpath, @"Pending Renewals", 0, 3).Contains(s4)); test.Info("Assert pass successfully for compare the 4th column header with respect to present header under Pending Renewals"); string s5 = ActivityHomePage.SalesCloseHeader(SelectBrowser.driver).Text; Assert.IsTrue(ExcelRead.GetCellData(pendRenDownXlpath, @"Pending Renewals", 0, 4).Contains(s5)); test.Info("Assert pass successfully for compare the 5th column header with respect to present header under Pending Renewals"); //Console.WriteLine("Assert pass for all 5 headers"); } catch (Exception ex) { Console.WriteLine("Exception==>" + ex); ScreenshotPage.TakesScreenshotWithDate(@"Screesnhot", System.Drawing.Imaging.ImageFormat.Png); } }
private void ReadExcelTableHead(AisinoCMB combox, string path, string sheetName, int HeadRow) { try { HeadRow--; if (HeadRow < 0) { HeadRow = 0; } combox.Items.Clear(); DataTable table = ExcelRead.ExcelToDataTable(path, sheetName + "$", 0); for (int i = 0; i < table.Columns.Count; i++) { int num2 = i + 1; combox.Items.Add("[" + num2.ToString() + "]" + table.Rows[HeadRow][i].ToString()); } } catch (Exception exception) { MessageBoxHelper.Show(exception.ToString(), "异常"); } }
public void ExportZu_ZhongDiBiao(JTSYQ jtsyqGroup, string saveDir) { // JTSYQCustom.SetContainsFeatureArea(jtsyqGroup); Dictionary <int, XMLTable> ClazzDic = XMLRead.GetXmlToXMLTabl(JTSYQCustom.DangZhongDi_Reflect); XMLTable xmlTable = ClazzDic[1]; IWorkbook workbook = ExcelRead.ReadExcel(JTSYQCustom.DangZhongDi); ISheet sheet = workbook.GetSheetAt(0); //行数据插入 IList <JTSYQ> list = new List <JTSYQ>(); list.Add(jtsyqGroup); double area = jtsyqGroup.Area; jtsyqGroup.Area = jtsyqGroup.Area * 10000; ExcelWrite.WriteObjects(sheet, xmlTable, list); ExcelWrite.Save(workbook, saveDir + "//" + jtsyqGroup.BM + ".xls"); jtsyqGroup.Area = area; }