本文整理汇总了C#中Microsoft.Close方法的典型用法代码示例。如果您正苦于以下问题:C# Microsoft.Close方法的具体用法?C# Microsoft.Close怎么用?C# Microsoft.Close使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft
的用法示例。
在下文中一共展示了Microsoft.Close方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Map
private CalendarItem Map(Microsoft.Office.Interop.Outlook.AppointmentItem item)
{
var calItem = new CalendarItem()
{
End = item.End,
Id = item.GlobalAppointmentID,
ItemId = item.GlobalAppointmentID,
Start = item.Start,
Summary = item.Subject,
Location = item.Location,
Organizer = item.Organizer,
Created = item.CreationTime,
Description = item.Body,
Attendees = item.Recipients.OfType<Microsoft.Office.Interop.Outlook.Recipient>().Select(x => new Attendee() { DisplayName = x.Name, Email = GetEmailOfRecipient(x), Optional = x.Type == 2 }).ToList(),
Locked = true,
Status = item.BusyStatus.ToString(),
Reminders = new List<Reminder> { new Reminder { Method = "popup", Minutes = item.ReminderMinutesBeforeStart } },
//Recurrence = GetRecurrence(item),
IsRecurring = item.IsRecurring,
CalendarId = item.GlobalAppointmentID
};
item.Close(Microsoft.Office.Interop.Outlook.OlInspectorClose.olDiscard);
return calItem;
}
示例2: Dispose
/// <summary>
/// 释放内存
/// </summary>
public void Dispose(Microsoft.Office.Interop.Excel._Worksheet CurSheet, Microsoft.Office.Interop.Excel._Workbook CurBook, Microsoft.Office.Interop.Excel._Application CurExcel)
{
try
{
System.Runtime.InteropServices.Marshal.ReleaseComObject(CurSheet);
CurSheet = null;
CurBook.Close(false, mValue, mValue);
System.Runtime.InteropServices.Marshal.ReleaseComObject(CurBook);
CurBook = null;
CurExcel.Quit();
System.Runtime.InteropServices.Marshal.ReleaseComObject(CurExcel);
CurExcel = null;
GC.Collect();
GC.WaitForPendingFinalizers();
}
catch (System.Exception ex)
{
// HttpContext.Current.Response.Write("在释放Excel内存空间时发生了一个错误:" + ex);
}
finally
{
foreach (System.Diagnostics.Process pro in System.Diagnostics.Process.GetProcessesByName("Excel"))
//if (pro.StartTime < DateTime.Now)
pro.Kill();
}
System.GC.SuppressFinalize(this);
}
示例3: CloseThreadHandle
private static void CloseThreadHandle(Microsoft.Win32.SafeHandles.SafeThreadHandle handle)
{
if (handle != null)
{
handle.Close();
}
}
示例4: ReleaseObjects
private void ReleaseObjects(Microsoft.Office.Interop.PowerPoint.Presentation _objPresentation, Application _objApplication)
{
GC.Collect();
GC.WaitForPendingFinalizers();
if (_objPresentation != null)
{
_objPresentation.Close();
//Marshal.FinalReleaseComObject(_objPresentation);
}
if (_objApplication != null)
{
_objApplication.Quit();
//Marshal.FinalReleaseComObject(_objApplication);
}
System.Diagnostics.Process[] pros = System.Diagnostics.Process.GetProcessesByName("POWERPNT");
for (int i = 0; i < pros.Length; i++)
{
pros[i].Kill();
}
}
示例5: CloseWorkBook
void CloseWorkBook(Microsoft.Office.Interop.Excel.Workbook ExcelWb, String TargetDirectory, String SaveName)
{
String ExcelFileName = Path.Combine(TargetDirectory, SaveName);
if (File.Exists(ExcelFileName))
File.Delete(ExcelFileName);
ExcelWb.SaveAs(ExcelFileName, Microsoft.Office.Interop.Excel.XlFileFormat.xlWorkbookDefault, Missing.Value,
Missing.Value, Missing.Value, Missing.Value, Microsoft.Office.Interop.Excel.XlSaveAsAccessMode.xlNoChange,
Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value);
ExcelWb.Close(Missing.Value, Missing.Value, Missing.Value);
ExcelApplication.Quit();
ExcelWb = null;
ExcelApplication = null;
}
示例6: CloseReadWorkbook
public void CloseReadWorkbook(Microsoft.Office.Interop.Excel.Workbook ExcelWb)
{
ExcelWb.Close(Missing.Value, Missing.Value, Missing.Value);
ExcelApplication.Quit();
ExcelWb = null;
ExcelApplication = null;
}
示例7: ReleaseProcessHandle
private void ReleaseProcessHandle(Microsoft.Win32.SafeHandles.SafeProcessHandle handle)
{
if ((handle != null) && (!this.haveProcessHandle || (handle != this.m_processHandle)))
{
handle.Close();
}
}
示例8: SaveDocument
private void SaveDocument(Microsoft.Office.Interop.Word.Document wordDocument, Microsoft.Office.Interop.Word.ApplicationClass wordApp, string filePath)
{
object Visible = false;
object missing = System.Reflection.Missing.Value;
Object Nothing = System.Reflection.Missing.Value;
object Save_FileName = filePath;
//保存模板文件
wordDocument.SaveAs(ref Save_FileName, ref missing, ref missing, ref missing, ref missing,
ref missing, ref missing, ref missing, ref Visible,
ref missing, ref missing, ref missing, ref missing, ref missing, ref missing,
ref missing);
//关闭wordDoc文档对象
wordDocument.Close(ref Nothing, ref Nothing, ref Nothing);
wordDocument = null;
//关闭wordApp组件对象
wordApp.Quit(ref Nothing, ref Nothing, ref Nothing);
}