本文整理汇总了C#中Workbook.SaveCopyAs方法的典型用法代码示例。如果您正苦于以下问题:C# Workbook.SaveCopyAs方法的具体用法?C# Workbook.SaveCopyAs怎么用?C# Workbook.SaveCopyAs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Workbook
的用法示例。
在下文中一共展示了Workbook.SaveCopyAs方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CompareLogs
//.........这里部分代码省略.........
// if (MainForm.StopGracefully)
// break;
// Sortera på new
var column = GetStandardExcelColumnName(colums + 1);
var range = newWorksheet.Range["A4", column + rows.ToString(CultureInfo.InvariantCulture)];
// "IV"
if (name != "DatabaseInfo")
{
range.Sort(
range.Columns[colums + 1, Type.Missing],
XlSortOrder.xlDescending,
// För att felsöka Excelprogrammering, använd macroEdit for VB i excel...
// range.Columns[2,Type.Missing], Type.Missing, Excel.XlSortOrder.xlDescending
Type.Missing,
Type.Missing,
XlSortOrder.xlDescending,
Type.Missing,
XlSortOrder.xlDescending,
XlYesNoGuess.xlNo,
Type.Missing,
Type.Missing,
XlSortOrientation.xlSortColumns,
// ReSharper disable RedundantArgumentDefaultValue
XlSortMethod.xlPinYin,
XlSortDataOption.xlSortNormal,
XlSortDataOption.xlSortNormal,
XlSortDataOption.xlSortNormal);
// ReSharper restore RedundantArgumentDefaultValue
}
// Ta bort "new"-kolumnen
range = newWorksheet.Range[column + 1, column + rows.ToString(CultureInfo.InvariantCulture)];
// "IV"
range.Delete(Type.Missing); // false//(object)false);//
// För old o diff överskriften...
if (name == "DatabaseInfo")
{
range = newWorksheet.Range["C:D", "C:D"];
range.EntireColumn.AutoFit(); // autofittar hela columnen för all som loggas
}
// newWorksheet.set
#endregion
}
// if (MainForm.StopGracefully)
// break;
}
else
{
Console.WriteLine(name + " didn't exist in old Excel book.");
}
// oldBook.Add(name, oldRows);
// _compareProgress.SetTotal(++sheetsDone);
}
// Spara en ny fil
// newLog.FullName = newLog.FullName + "-Compared";
// newLog.Save();// .Save();
newLogFileName = newLog.FullName.Replace(".xls", string.Empty) + "-Compared" + ".xls";
newLog.SaveCopyAs(newLogFileName); // MainForm.LastLogPath);//newLog.FullName + "-Compared");
newLog.Close(false, Type.Missing, Type.Missing);
// _book.Close(false, Type.Missing, Type.Missing);
excelApp.Quit();
System.Runtime.InteropServices.Marshal.ReleaseComObject(excelApp);
excelApp = null;
}
catch (Exception e)
{
// MessageBox.Show("Error in comparing old log with new log. Was the log opened in Excel during compare processing?\r\n\r\n(Sys err: " + e.Message + ").");
// throw e;
throw new Exception(
"Error in comparing old log with new log. Was the log opened in Excel during compare processing?\r\n\r\n(Sys err: "
+ e.Message + ").",
e);
}
#endregion - read new
System.Threading.Thread.CurrentThread.CurrentCulture = oldCi;
// MainForm.ShowTextProgress = false;//Visar inte ens texten längre
// MainForm.ShowProgress = orgProgresSetting;//Håller på vad progress vad satt till innan
// Stäng Excel
if (excelApp != null)
{
excelApp.Quit();
System.Runtime.InteropServices.Marshal.ReleaseComObject(excelApp);
excelApp = null;
}
}