From 544d3ee15892eb5a139696cb2e3e01354b19adf0 Mon Sep 17 00:00:00 2001 From: RKrom Date: Thu, 3 May 2012 10:16:19 +0000 Subject: [PATCH] Fixed issue with exporting to plain text mails. Now the screenshot is attached, before it was "in line" if outlook >=2007 was used BUT when sending a popup was shown. git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@1829 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4 --- .../OfficeExport/OutlookEmailExporter.cs | 38 ++++++++++--------- 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/GreenshotInterop/OfficeExport/OutlookEmailExporter.cs b/GreenshotInterop/OfficeExport/OutlookEmailExporter.cs index e3c82b1d1..7331dc468 100644 --- a/GreenshotInterop/OfficeExport/OutlookEmailExporter.cs +++ b/GreenshotInterop/OfficeExport/OutlookEmailExporter.cs @@ -180,26 +180,28 @@ namespace Greenshot.Interop.Office { // Make sure the inspector is activated, only this way the word editor is active! // This also ensures that the window is visible! inspector.Activate(); + bool isTextFormat = OlBodyFormat.olFormatPlain.Equals(mailItem.BodyFormat); + if (isAppointment || !isTextFormat) { + // Check for wordmail, if so use the wordexporter + // 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"); - // Check for wordmail, if so use the wordexporter - // 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"); - - // 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; + } + } else if (isAppointment) { + LOG.Info("Can't export to an appointment if no word editor is used"); + return false; + } else { + LOG.Info("Trying export for outlook < 2007."); } - } else if (isAppointment) { - LOG.Info("Can't export to an appointment if no word editor is used"); - return false; - } else { - LOG.Info("Trying export for word < 2007."); } // Only use mailitem as it should be filled!! LOG.InfoFormat("Item '{0}' has format: {1}", mailItem.Subject, mailItem.BodyFormat);