本文整理汇总了C#中NetOffice.Dispose方法的典型用法代码示例。如果您正苦于以下问题:C# NetOffice.Dispose方法的具体用法?C# NetOffice.Dispose怎么用?C# NetOffice.Dispose使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NetOffice
的用法示例。
在下文中一共展示了NetOffice.Dispose方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: commandBarBtn_ClickEvent
/// <summary>
/// Click event trigger from created buttons. incoming call comes from word application thread.
/// </summary>
/// <param name="Ctrl"></param>
/// <param name="CancelDefault"></param>
void commandBarBtn_ClickEvent(NetOffice.OfficeApi.CommandBarButton Ctrl, ref bool CancelDefault)
{
string message = string.Format("Click from Button {0}.", Ctrl.Caption);
MessageBox.Show(message, _progId, MessageBoxButtons.OK, MessageBoxIcon.Information);
Ctrl.Dispose();
}
示例2: Application_SheetSelectionChangeEvent
/// <summary>
/// This method was called from the host instance after selection changed.
/// </summary>
/// <param name="selectedRange">active selection</param>
private void Application_SheetSelectionChangeEvent(NetOffice.COMObject sh, Excel.Range selectedRange)
{
try
{
// we check for auto translation and skip selections with more than 256 cells for this simple example
if (checkBoxAutoTranslate.Checked && selectedRange.Count <= 256)
{
ClearError();
textBoxTranslation.Text = string.Empty;
foreach (var item in selectedRange)
{
string requestedText = item.Text as string;
if (!String.IsNullOrWhiteSpace(requestedText))
{
string translatedText = Client.DataService.Translate(
comboBoxSourceLanguage.SelectedItem as string,
comboBoxTargetLanguage.SelectedItem as string,
requestedText);
textBoxTranslation.Text += translatedText + " ";
}
}
}
sh.Dispose();
selectedRange.Dispose();
}
catch (Exception exception)
{
ShowError(string.Format("An errror occured. Details: {0}", exception.Message));
}
}
示例3: Application_WindowSelectionChangeEvent
void Application_WindowSelectionChangeEvent(NetOffice.WordApi.Selection Sel)
{
try
{
if (checkBoxAutoSearch.Checked)
{
textBoxKeyWords.Text = Sel.Text.Replace("\r", "");
buttonSearch_Click(buttonSearch, new EventArgs());
}
Sel.Dispose();
}
catch (Exception exception)
{
DisplayError(exception);
}
}
示例4: commandBarBtn_ClickEvent
/// <summary>
/// Click event trigger from created buttons. incoming call comes from excel application thread.
/// </summary>
/// <param name="Ctrl"></param>
/// <param name="CancelDefault"></param>
private void commandBarBtn_ClickEvent(NetOffice.OfficeApi.CommandBarButton Ctrl, ref bool CancelDefault)
{
try
{
string message = string.Format("Click from Button {0}.", Ctrl.Caption);
MessageBox.Show(message, _progId, MessageBoxButtons.OK, MessageBoxIcon.Information);
Ctrl.Dispose();
}
catch (Exception exception)
{
string message = string.Format("An error occured.{0}{0}{1}", Environment.NewLine, exception.Message);
MessageBox.Show(message, _progId, MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
示例5: powerApplication_PresentationCloseEvent
void powerApplication_PresentationCloseEvent(NetOffice.PowerPointApi.Presentation Pres)
{
_presentationClose = true;
Pres.Dispose();
}
示例6: powerApplication_AfterNewPresentationEvent
void powerApplication_AfterNewPresentationEvent(NetOffice.PowerPointApi.Presentation Pres)
{
_afterNewPresentation = true;
Pres.Dispose();
}
示例7: powerApplication_AfterNewPresentationEvent
private void powerApplication_AfterNewPresentationEvent(NetOffice.PowerPointApi.Presentation Pres)
{
textBoxEvents.BeginInvoke(_updateDelegate, new object[] { "Event AfterNewPresentation called." });
Pres.Dispose();
}
示例8: wordApplication_NewDocumentEvent
void wordApplication_NewDocumentEvent(NetOffice.WordApi.Document Doc)
{
_newDocumentCalled = true;
Doc.Dispose();
}
示例9: wordApplication_DocumentBeforeCloseEvent
void wordApplication_DocumentBeforeCloseEvent(NetOffice.WordApi.Document Doc, ref bool Cancel)
{
_beforeCloseCalled = true;
Doc.Dispose();
}
示例10: wordApplication_NewDocumentEvent
void wordApplication_NewDocumentEvent(NetOffice.WordApi.Document Doc)
{
textBoxEvents.BeginInvoke(_updateDelegate, new object[] { "Event NewDocumentEvent called." });
Doc.Dispose();
}
示例11: wordApplication_DocumentBeforeCloseEvent
void wordApplication_DocumentBeforeCloseEvent(NetOffice.WordApi.Document Doc, ref bool Cancel)
{
textBoxEvents.BeginInvoke(_updateDelegate, new object[] { "Event DocumentBeforeClose called." });
Doc.Dispose();
}