Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6879981
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T04:54:58+00:00 2026-05-27T04:54:58+00:00

I’m trying to programatically generate and copy formatted text to the clipboard for the

  • 0

I’m trying to programatically generate and copy formatted text to the clipboard for the purposes of pasting it into an e-mail. The only formatting I want to copy is line breaks and bold text. I want it to use the e-mail’s current or default font.

Licensed to: XXXXX
License key: XXXXX

My attempts at HTML produce the correct formatting in Windows Live Mail, but with it’s own choice of font.

Dim Text As String =
    "Version:0.9" & vbCrLf &
    "StartHTML:00000097" & vbCrLf &
    "EndHTML:00000343" & vbCrLf &
    "StartFragment:00000243" & vbCrLf &
    "EndFragment:00000308" & vbCrLf &
    "<!DOCTYPE HTML PUBLIC ""-//W3C//DTD HTML 4.01 Transitional//EN"">" & vbCrLf &
    "<HTML><HEAD><TITLE>Software License</TITLE></HEAD><BODY>" & vbCrLf &
    "<!--StartFragment -->" & vbCrLf &
    "<P><B>Licensed to:</B> XXXXX<BR /><B>License key:</B> XXXXX</P>" & vbCrLf &
    "<!--EndFragment -->" & vbCrLf &
    "</BODY></HTML>"
Clipboard.SetText(Text, TextDataFormat.Html)

My attempts at RTF paste in WordPad properly, but pasting in Windows Live Mail simple does nothing.

Dim Text As String =
    "{\rtf1\ansi " &
    "\b Licensed to:\b0  XXXXX\par " &
    "\b License key:\b0  XXXXX\par " &
    "}"
Clipboard.SetText(Text, TextDataFormat.Rtf)

Does anyone know a solution to copy limited formatting to the clipboard.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T04:54:58+00:00Added an answer on May 27, 2026 at 4:54 am

    This is really format-specific (and in some ways application specific). You’ve found out how to do it for two cases, but should be aware of why it is working as it is:

    When you attempt to paste data from the clipboard in a application (say, outlook), that application first queries the clipboard to see what formats are available, and will choose the available format “best” for it (as determined by Outlook’s developers). If no formats are available that work for that application, then it acts as if no data is on the clipboard. This explains why wordpad can handle RTF data, but live mail does not.

    What you can (and should) do, is put data on the clipboard in multiple formats to allow other apps to pick and choose.

    Instead of using Clipboard.SetText(), use Clipboard.SetDataObject(), and fill a DataObject with multiple formats

    Dim htmlText as String = ''your working html
    Dim rtfText as String = ''your working rtf
    
    Dim data As New DataObject()
    data.SetText(htmlText, TextDataFormat.Html)
    data.SetText(rtfText, TextDataFormat.Rtf)
    ''and possibly:
    data.SetText(plainText, TextDataFormat.Text)
    
    
    Clipboard.SetDataObject(data)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a French site that I want to parse, but am running into
I want use html5's new tag to play a wav file (currently only supported
I have a bunch of posts stored in text files formatted in yaml/textile (from
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
I want to count how many characters a certain string has in PHP, but
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.