/// <summary> /// 另存为xls文件 /// </summary> /// <param name="CurBook">Workbook</param> /// <param name="strFilePath">文件路径</param> public void Save(Microsoft.Office.Interop.Excel._Workbook CurBook, string strFilePath) { CurBook.SaveCopyAs(strFilePath); }
GetWorkbookContents ( Microsoft.Office.Interop.Excel.Workbook oWorkbook ) { Debug.Assert(oWorkbook != null); // Save the workbook to a temporary file, then read the temporary file. String sTempFilePath = Path.GetTempFileName(); try { oWorkbook.SaveCopyAs(sTempFilePath); return ( FileUtil.ReadBinaryFile(sTempFilePath) ); } finally { if ( File.Exists(sTempFilePath) ) { File.Delete(sTempFilePath); } } }