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
This commit is contained in:
RKrom 2012-05-03 10:16:19 +00:00
commit 544d3ee158

View file

@ -180,26 +180,28 @@ namespace Greenshot.Interop.Office {
// Make sure the inspector is activated, only this way the word editor is active! // Make sure the inspector is activated, only this way the word editor is active!
// This also ensures that the window is visible! // This also ensures that the window is visible!
inspector.Activate(); 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 // check the format afterwards, otherwise we lose the selection
// http://msdn.microsoft.com/en-us/library/dd492012%28v=office.12%29.aspx //if (!OlBodyFormat.olFormatHTML.Equals(currentMail.BodyFormat)) {
// 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. // LOG.Info("Changing format to HTML.");
if (inspector.IsWordMail() && inspector.WordEditor != null) { // currentMail.BodyFormat = OlBodyFormat.olFormatHTML;
if (WordExporter.InsertIntoExistingDocument(inspector.WordEditor, tmpFile)) { //}
LOG.Info("Inserted into Wordmail"); return true;
}
// check the format afterwards, otherwise we lose the selection } else if (isAppointment) {
//if (!OlBodyFormat.olFormatHTML.Equals(currentMail.BodyFormat)) { LOG.Info("Can't export to an appointment if no word editor is used");
// LOG.Info("Changing format to HTML."); return false;
// currentMail.BodyFormat = OlBodyFormat.olFormatHTML; } else {
//} LOG.Info("Trying export for outlook < 2007.");
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 word < 2007.");
} }
// Only use mailitem as it should be filled!! // Only use mailitem as it should be filled!!
LOG.InfoFormat("Item '{0}' has format: {1}", mailItem.Subject, mailItem.BodyFormat); LOG.InfoFormat("Item '{0}' has format: {1}", mailItem.Subject, mailItem.BodyFormat);