mirror of
https://github.com/greenshot/greenshot
synced 2025-08-21 14:03:23 -07:00
Added the possibility to have a link to e.g. the original website when exporting to Outlook or Word.
git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@2444 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4
This commit is contained in:
parent
00a01236e0
commit
609075f8d1
5 changed files with 91 additions and 19 deletions
|
@ -289,7 +289,7 @@ namespace Greenshot.Interop.Office {
|
|||
/// <param name="outlookApplication"></param>
|
||||
/// <param name="tmpFile"></param>
|
||||
/// <param name="captureDetails"></param>
|
||||
private static void ExportToNewEmail(IOutlookApplication outlookApplication, EmailFormat format, string tmpFile, string subject, string attachmentName, string to, string CC, string BCC) {
|
||||
private static void ExportToNewEmail(IOutlookApplication outlookApplication, EmailFormat format, string tmpFile, string subject, string attachmentName, string to, string CC, string BCC, string url) {
|
||||
Item newItem = outlookApplication.CreateItem(OlItemType.olMailItem);
|
||||
if (newItem == null) {
|
||||
return;
|
||||
|
@ -342,7 +342,13 @@ namespace Greenshot.Interop.Office {
|
|||
}
|
||||
|
||||
newMail.BodyFormat = OlBodyFormat.olFormatHTML;
|
||||
string htmlImgEmbedded = "<BR/><IMG border=0 hspace=0 alt=\"" + attachmentName + "\" align=baseline src=\"cid:" + contentID + "\"><BR/>";
|
||||
string href = "";
|
||||
string hrefEnd = "";
|
||||
if (!string.IsNullOrEmpty(url)) {
|
||||
href = string.Format("<A HREF=\"{0}\">", url);
|
||||
hrefEnd = "</A>";
|
||||
}
|
||||
string htmlImgEmbedded = string.Format("<BR/>{0}<IMG border=0 hspace=0 alt=\"{1}\" align=baseline src=\"cid:{2}\"><BR/>", href, attachmentName, contentID, hrefEnd);
|
||||
string fallbackBody = "<HTML><BODY>" + htmlImgEmbedded + "</BODY></HTML>";
|
||||
if (bodyString == null) {
|
||||
bodyString = fallbackBody;
|
||||
|
@ -376,12 +382,12 @@ namespace Greenshot.Interop.Office {
|
|||
/// </summary>
|
||||
/// <param name="tmpfile">The file to send, do not delete the file right away!</param>
|
||||
/// <returns>true if it worked, false if not</returns>
|
||||
public static bool ExportToOutlook(EmailFormat format, string tmpFile, string subject, string attachmentName, string to, string CC, string BCC) {
|
||||
public static bool ExportToOutlook(EmailFormat format, string tmpFile, string subject, string attachmentName, string to, string CC, string BCC, string url) {
|
||||
bool exported = false;
|
||||
try {
|
||||
using (IOutlookApplication outlookApplication = GetOrCreateOutlookApplication()) {
|
||||
if (outlookApplication != null) {
|
||||
ExportToNewEmail(outlookApplication, format, tmpFile, subject, attachmentName, to, CC, BCC);
|
||||
ExportToNewEmail(outlookApplication, format, tmpFile, subject, attachmentName, to, CC, BCC, url);
|
||||
exported = true;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue