public Form1() { InitializeComponent(); panel3.Visible = false; Court.LABEL = label5; UpdateExcel.InitializeComponent(); }
private void transformDate(string path, string ext) { if (string.Equals(ext, ".xlsx", StringComparison.CurrentCultureIgnoreCase) || string.Equals(ext, ".xls", StringComparison.CurrentCultureIgnoreCase)) { try { Court.excel = new Excel(@path, 1); String[,] _temp = Court.excel.ReadAll(); if (Court.numberSeparated) { for (int j = 0; j < Court.excel.cols; j++) { string _expression = @"^[\p{L}]+(.*)\d+[.]?\d*%?$"; Regex _objNotNumberPattern = new Regex(_expression); if (_objNotNumberPattern.IsMatch(_temp[1, j])) { Court.excel.specfialCol = j + 1; break; } } Court.excel.pushCol(Court.excel.specfialCol); UpdateExcel.UpdateSpecialReplace(); listBox1.Items.Add(System.IO.Path.GetFileNameWithoutExtension(path) + "...processed successfully!"); } else if (Court.lineSeparated) { //Court.excel.specfialCol = UpdateExcel.UpdateSpecialColumn(); //if (Court.excel.specfialCol == 0) //{ // MessageBox.Show("Coundn't find a column with multiple lines."); //} //Court.excel.pushCol(Court.excel.specfialCol); //UpdateExcel.UpdateSpecialSeparate(); UpdateExcel.UpdateSpecialSeparateRandom(); } Court.excel.SaveAs(path.Insert(path.LastIndexOf("."), "_transformed")); } catch (Exception) { throw; } finally { Court.excel.Close(); } } else { MessageBox.Show("Some files are not in .xlsx format."); listBox2.Items.RemoveAt(listBox2.Items.Count - 1); } }
private void button2_Click(object sender, EventArgs e) { if (Court.excel == null) { listBox2.Items.Clear(); listBox1.Items.Clear(); UpdateExcel.UpdateProcessedRow(); MessageBox.Show("You haven't started processing any file(s) yet."); } else { listBox2.Items.Clear(); listBox1.Items.Clear(); Court.excel.Clear(); UpdateExcel.UpdateProcessedRow(); } }