Delphi Pages Forums  

Go Back   Delphi Pages Forums > Delphi Forum > General

Lost Password?

Closed Thread
 
Thread Tools Display Modes
  #1  
Old 11-10-2015, 07:28 AM
ShaunVW ShaunVW is offline
Member
 
Join Date: Feb 2012
Posts: 47
Default Copying from clipboard into an html string

This is really a follow on from http://www.delphipages.com/forum/sho...d.php?t=217300

I have manage to create a graph in Excel, and move the graph as an image onto the clipboard.
In an existing program, I create an HTML string with a whole lot of info, which I then use as the body of an email.

I want to now include the image that is stored on the clipboard in the body of the html.
Can someone possibly assist me on this?
Lots of examples I've seen embed an image into the html by referencing an existing file, however I don't have a file, only the contents on the clipboard.

This is an example of the html that I currently generate...

Code:
 
   htmlString := TStringList.Create;
   htmlString.Add('On receiving this email, please can the champion (Roy N) respond by the end of the day the follow-up action taken with a reply-to-all email.
 
');
 htmlString.Add(''); htmlString.Add('
'); htmlString.Add('
'); htmlString.Add('
'); htmlString.Add('
'); htmlString.Add('
Pur. No. Stock Code
');
I now need to somehow add the clipboard contents.
(Sorry for the different formatting, somehow my html tags have been recognised within the code blocks!)
  #2  
Old 11-10-2015, 09:21 AM
ShaunVW ShaunVW is offline
Member
 
Join Date: Feb 2012
Posts: 47
Default

I've tried a whole lot of variations of the following, but no luck, where emailBody contains the html strings:

Code:
emailBody.Add('');
The above should read
HTML Code:
emailBody.Add('<img src=clipboarddata.getdata>');

Last edited by ShaunVW; 11-10-2015 at 09:30 AM. Reason: Not formatting as wanted
  #3  
Old 11-10-2015, 11:55 AM
drama22 drama22 is offline
Senior Member
 
Join Date: Jul 2014
Posts: 201
Default

i don't understand , do you mean you need to copy an html Code to a plain text html
  #4  
Old 11-10-2015, 12:08 PM
ShaunVW ShaunVW is offline
Member
 
Join Date: Feb 2012
Posts: 47
Default

No, I have an image that I have copied to the clipboard.
I now want to include this image into an email that I send out automatically.
The html string is actually a TStringList object which I add html to in order to format my email body. After the text, I now want to add the image embedded into the main body of the email.

The closest I find to what I want is the following, but it does not work.

HTML Code:
emailBody.Add('<img src="data:image/png;base64,data">');
If I have the image saved to a file, then I use something like

HTML Code:
emailBody.Add('<img src="C:/Pictures/Pic.jpg">');
and that works well.
However, I don't have it in a file, it is on the clipboard.

Last edited by ShaunVW; 11-10-2015 at 12:11 PM.
  #5  
Old 11-10-2015, 12:43 PM
ShaunVW ShaunVW is offline
Member
 
Join Date: Feb 2012
Posts: 47
Default

I can't seem to come right with how I want to do this, so my workaround tis to create a TPicture, copy the clipboard into the TPicture object, save it to a temporary file, and then link to this file instead.

HTML Code:
  Pic := TPicture.Create();
  if Clipboard.HasFormat(CF_BITMAP) then
   begin
    Pic.Assign(Clipboard);
    Pic.SaveToFile('c:\Pictures\abc.bmp');
    emailBody.Add('[IMG]http://www.delphipages.com/forum/C:/Pictures/abc.bmp[/IMG]');
   end;
Closed Thread

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT. The time now is 02:21 PM.


Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2018, vBulletin Solutions, Inc.