Beispiel #1
0
        private void ExportDifferentExcel(ExcelBook E, string FileName = "")
        {
            ExcelBook N = new ExcelBook();

            try
            {
                ExcelSheet S = new ExcelSheet(E.ExcelSheet(comboBoxSSheetName.SelectedItem.ToString()));
                ExcelSheet L = new ExcelSheet(E.ExcelSheet(comboBoxLSheetName.SelectedItem.ToString()));
                if (FileName != "")
                {
                    N.Create();
                    ExcelSheet NL = new ExcelSheet(N.CopySheetAndDeleteOther(L));
                    ExcelSheet NS = new ExcelSheet(N.CopySheet(S));
                    NS.FormatExcelRange(SP, _colorDif, "不同");
                    NL.FormatExcelRange(LP, _colorDif, "不同");
                    N.SaveAs(FileName);
                }
                else
                {
                    S.FormatExcelRange(SP, _colorDif, "不同");
                    L.FormatExcelRange(LP, _colorDif, "不同");
                }
            }
            finally
            {
                N = null;
            }
        }
Beispiel #2
0
        private void ExportDuplicationExcel(ExcelBook E, string FileName = "")
        {
            ExcelBook N = new ExcelBook();

            try
            {
                ExcelSheet S = new ExcelSheet(E.ExcelSheet(comboBoxSSheetName.SelectedItem.ToString()));
                ExcelSheet L = new ExcelSheet(E.ExcelSheet(comboBoxLSheetName.SelectedItem.ToString()));

                List <int> LDuplication = new List <int>();
                List <int> SDuplication = new List <int>();
                foreach (List <int> l in LDicDuplication.Values)
                {
                    LDuplication.AddRange(l);
                }
                foreach (List <int> l in SDicDuplication.Values)
                {
                    SDuplication.AddRange(l);
                }

                if (FileName != "")
                {
                    N.Create();

                    if (LDuplication.Count > 0)
                    {
                        new ExcelSheet(N.CopySheetRowsAndDeleteOther(L, LDuplication));
                    }

                    if (SDuplication.Count > 0)
                    {
                        if (LDuplication.Count > 0)
                        {
                            new ExcelSheet(N.CopySheetRows(S, SDuplication));
                        }
                        else
                        {
                            new ExcelSheet(N.CopySheetRowsAndDeleteOther(S, SDuplication));
                        }
                    }
                    N.SaveAs(FileName);
                }
                else
                {
                    List <Point> SD = SDuplication.Select(r => new Point(r, 2)).ToList();
                    List <Point> LD = SDuplication.Select(r => new Point(r, 2)).ToList();
                    S.FormatExcelRange(SD, _colorDup, "重复");
                    L.FormatExcelRange(LD, _colorDup, "重复");
                }
            }
            finally
            {
                N = null;
            }
        }
Beispiel #3
0
        private void ExportSpecialExcel(ExcelBook E, string FileName = "")
        {
            ExcelBook N = new ExcelBook();

            try
            {
                ExcelSheet S = new ExcelSheet(E.ExcelSheet(comboBoxSSheetName.SelectedItem.ToString()));
                ExcelSheet L = new ExcelSheet(E.ExcelSheet(comboBoxLSheetName.SelectedItem.ToString()));
                if (FileName != "")
                {
                    N.Create();
                    if (LSpecial.Count > 0)
                    {
                        new ExcelSheet(N.CopySheetAndDeleteOther(L)).FormatExcelRange(LSpecial, Color.Pink, "特有");
                    }
                    if (SSpecial.Count > 0)
                    {
                        if (LSpecial.Count > 0)
                        {
                            new ExcelSheet(N.CopySheet(S)).FormatExcelRange(SSpecial, Color.Pink, "特有");
                        }
                        else
                        {
                            new ExcelSheet(N.CopySheetAndDeleteOther(S)).FormatExcelRange(SSpecial, Color.Pink, "特有");
                        }
                    }
                    N.SaveAs(FileName);
                }
                else
                {
                    S.FormatExcelRange(SSpecial, _colorSpe, "特有");
                    L.FormatExcelRange(LSpecial, _colorSpe, "特有");
                }
            }
            finally
            {
                N = null;
            }
        }