Exemplo n.º 1
0
        private void CompareMultiSheetClick()
        {
            ExcelBook  E = new ExcelBook(m_cfg.XlsName);
            ExcelSheet S = new ExcelSheet(E.ExcelSheet(comboBoxSSheetName.SelectedItem.ToString()));
            ExcelSheet L = new ExcelSheet(E.ExcelSheet(comboBoxLSheetName.SelectedItem.ToString()));

            try
            {
                if (checkBoxClearBackColor.Checked)
                {
                    S.ClearBackColor();
                    L.ClearBackColor();
                }
                Compare(S, L);
                if (checkBoxTagL.Checked || checkBoxTagS.Checked)
                {
                    if (LSpecial.Count > 0 || SSpecial.Count > 0)
                    {
                        ExportSpecialExcel(E);
                    }
                }
                if (checkBoxCopyDuplicationL.Checked || checkBoxCopyDuplicationS.Checked)
                {
                    if (LDicDuplication.Count > 0 || SDicDuplication.Count > 0)
                    {
                        ExportDuplicationExcel(E);
                    }
                }
                if (checkBoxDifL.Checked || checkBoxDifS.Checked)
                {
                    if (LP.Count > 0 || SP.Count > 0)
                    {
                        ExportDifferentExcel(E);
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("程序有点小问题\r\n" + ex.Message);
            }
            finally
            {
                S = null;
                L = null;
                ExcelBook.excel.ActiveWorkbook.Save();
                ExcelBook.excel.Workbooks.Close();
            }
        }