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; } }
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; } }