diff --git a/GreenshotInterop/OfficeExport/OutlookEmailExporter.cs b/GreenshotInterop/OfficeExport/OutlookEmailExporter.cs
index 056768b75..ba3050617 100644
--- a/GreenshotInterop/OfficeExport/OutlookEmailExporter.cs
+++ b/GreenshotInterop/OfficeExport/OutlookEmailExporter.cs
@@ -192,15 +192,19 @@ namespace Greenshot.Interop.Office {
// http://msdn.microsoft.com/en-us/library/dd492012%28v=office.12%29.aspx
// Earlier versions of Outlook also supported an Inspector.HTMLEditor object property, but since Internet Explorer is no longer the rendering engine for HTML messages and posts, HTMLEditor is no longer supported.
if (inspector.IsWordMail() && inspector.WordEditor != null) {
- if (WordExporter.InsertIntoExistingDocument(inspector.WordEditor, tmpFile)) {
- LOG.Info("Inserted into Wordmail");
+ try {
+ if (WordExporter.InsertIntoExistingDocument(inspector.WordEditor.Application, inspector.WordEditor, tmpFile)) {
+ LOG.Info("Inserted into Wordmail");
- // check the format afterwards, otherwise we lose the selection
- //if (!OlBodyFormat.olFormatHTML.Equals(currentMail.BodyFormat)) {
- // LOG.Info("Changing format to HTML.");
- // currentMail.BodyFormat = OlBodyFormat.olFormatHTML;
- //}
- return true;
+ // check the format afterwards, otherwise we lose the selection
+ //if (!OlBodyFormat.olFormatHTML.Equals(currentMail.BodyFormat)) {
+ // LOG.Info("Changing format to HTML.");
+ // currentMail.BodyFormat = OlBodyFormat.olFormatHTML;
+ //}
+ return true;
+ }
+ } catch (Exception exportException) {
+ LOG.Error("Error exporting to the word editor, trying to do it via another method", exportException);
}
} else if (isAppointment) {
LOG.Info("Can't export to an appointment if no word editor is used");
diff --git a/GreenshotInterop/OfficeExport/WordExporter.cs b/GreenshotInterop/OfficeExport/WordExporter.cs
index 7b1dc7965..ed22f0221 100644
--- a/GreenshotInterop/OfficeExport/WordExporter.cs
+++ b/GreenshotInterop/OfficeExport/WordExporter.cs
@@ -47,7 +47,7 @@ namespace Greenshot.Interop.Office {
for (int i = 1; i <= wordApplication.Documents.Count; i++) {
using (IWordDocument wordDocument = wordApplication.Documents.item(i)) {
if (wordDocument.ActiveWindow.Caption.StartsWith(wordCaption)) {
- return InsertIntoExistingDocument(wordDocument, tmpFile);
+ return InsertIntoExistingDocument(wordApplication, wordDocument, tmpFile);
}
}
}
@@ -56,9 +56,16 @@ namespace Greenshot.Interop.Office {
return false;
}
- internal static bool InsertIntoExistingDocument(IWordDocument wordDocument, string tmpFile) {
- if (wordDocument.Application.Selection != null) {
- AddPictureToSelection(wordDocument.Application.Selection, tmpFile);
+ ///
+ /// Internal method for the insert
+ ///
+ ///
+ ///
+ ///
+ ///
+ internal static bool InsertIntoExistingDocument(IWordApplication wordApplication, IWordDocument wordDocument, string tmpFile) {
+ if (wordApplication.Selection != null) {
+ AddPictureToSelection(wordApplication.Selection, tmpFile);
try {
wordDocument.ActiveWindow.ActivePane.View.Zoom.Percentage = 100;
} catch (Exception e) {
@@ -69,7 +76,7 @@ namespace Greenshot.Interop.Office {
}
}
try {
- wordDocument.Application.Activate();
+ wordApplication.Activate();
} catch {}
try {
wordDocument.Activate();
diff --git a/GreenshotPlugin/Core/SourceForgeHelper.cs b/GreenshotPlugin/Core/SourceForgeHelper.cs
index e033c1082..93c82d687 100644
--- a/GreenshotPlugin/Core/SourceForgeHelper.cs
+++ b/GreenshotPlugin/Core/SourceForgeHelper.cs
@@ -167,7 +167,7 @@ namespace GreenshotPlugin.Core {
try {
CultureInfo cultureInfo = new CultureInfo(culture);
rssFile.Language = cultureInfo.NativeName;
- } catch (Exception ex) {
+ } catch (Exception) {
LOG.WarnFormat("Can't read the native name of the culture {0}", culture);
}
}