Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Format of CF_RTFTEXT clipboard data

Posted on 2002-04-22
4
Medium Priority
?
1,108 Views
Last Modified: 2013-12-28
(This isn't an NT question specifically, but
there doesn't seem to be a "Windows General")

I would like a specification of the format
in which data is stored in the clipboard
when it represents Rich Text.
0
Comment
Question by:trovatore
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 63

Expert Comment

by:SysExpert
ID: 6961639
I think you need to delve into the Windows SDK to learn the format.

See the ms site for developers, it may be something that you can simply download.

I hope this helps !
0
 

Author Comment

by:trovatore
ID: 6962320
Hmm, it's a good general tip and might have been useful
in general, but it doesn't really seem worth 200 points.

Anyway, I figured it out, I think.  The clipboard
format seems to be the same as the Rich Text format
itself.  I guess that's logical but for some reason
it didn't occur to me.
0
 
LVL 3

Accepted Solution

by:
gcauthon earned 800 total points
ID: 6963091
See the documentation for clipboard format functions for more information on the possible formats.  EnumClipboardFormats is of particular interest:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wceui40/htm/cerefEnumClipboardFormats.asp

When you read data from the clipboard it can be read in a variety of different formats.  All of the different formats are stored separately so there isn't one place where all of the data is stored.  It is up to the application that writes to the clipboard to store as many different formats as relevant when the user hits the copy button.  Basically, the structure of the data is up to the application as well (with the exception of bmp's, riff files, wav files, etc.).  Here is an example of the output from EnumClipboardFormats and GetClipboardData for a simple rtf snippet:

D:\Source>EnumClipboardFormats
format(49161): DataObject
format(49166): Object Descriptor
format(49272): Rich Text Format
format(49457): HTML Format
format(1): <no name>
format(13): <no name>
format(3): <no name>
format(49163): Embed Source
format(49156): Native
format(49155): OwnerLink
format(49165): Link Source
format(49167): Link Source Descriptor
format(49154): ObjectLink
format(49545): Hyperlink
format(49171): Ole Private Data
format(16): <no name>
format(7): <no name>
format(14): <no name>

D:\Source>GetClipboardData 49457
Clipboard Data:
Version:1.0
StartHTML:0000000144
EndHTML:0000001941
StartFragment:0000001346
EndFragment:0000001901
SourceURL:file:///H:/Docs/Testing.rtf

<html xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:w="urn:schemas-microsoft-com:office:word"
xmlns="http://www.w3.org/TR/REC-html40">

<head>
<meta http-equiv=Content-Type content="text/html; charset=utf-8">
<meta name=ProgId content=Word.Document>
<meta name=Generator content="Microsoft Word 9">
<meta name=Originator content="Microsoft Word 9">
<link rel=File-List href="file:///C:/TEMP/msoclip1/03/clip_filelist.xml">
<!--[if gte mso 9]><xml>
 <w:WordDocument>
  <w:View>Normal</w:View>
  <w:Zoom>0</w:Zoom>
  <w:DoNotOptimizeForBrowser/>
 </w:WordDocument>
</xml><![endif]-->
<style>
<!--
 /* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {mso-style-parent:"";
        margin:0in;
        margin-bottom:.0001pt;
        mso-pagination:widow-orphan;
        font-size:12.0pt;
        font-family:"Times New Roman";
        mso-fareast-font-family:"Times New Roman";
        mso-bidi-font-family:"Times New Roman";}
@page Section1
        {size:8.5in 11.0in;
        margin:1.0in 1.25in 1.0in 1.25in;
        mso-header-margin:.5in;
        mso-footer-margin:.5in;
        mso-paper-source:0;}
div.Section1
        {page:Section1;}
-->
</style>
</head>

<body lang=EN-US style='tab-interval:.5in'>
<!--StartFragment-->

<p class=MsoNormal><span style='font-size:20.0pt;mso-bidi-font-size:12.0pt;
font-family:Arial'>Testing<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:20.0pt;mso-bidi-font-size:12.0pt;
font-family:Arial'>Testing<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:20.0pt;mso-bidi-font-size:12.0pt;
font-family:Arial'>Testing<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:20.0pt;mso-bidi-font-size:12.0pt;
font-family:Arial'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></span><
/p>

<!--EndFragment-->
</body>

</html>


D:\Source>GetClipboardData 49272
Clipboard Data:
{\rtf1\ansi\ansicpg1252\uc1 \deff0\deflang1033\deflangfe1033{\fonttbl{\f0\froman
\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\f1\fswiss\fch
arset0\fprq2{\*\panose 020b0604020202020204}Arial;}
{\f159\froman\fcharset238\fprq2 Times New Roman CE;}{\f160\froman\fcharset204\fp
rq2 Times New Roman Cyr;}{\f162\froman\fcharset161\fprq2 Times New Roman Greek;}
{\f163\froman\fcharset162\fprq2 Times New Roman Tur;}
{\f166\froman\fcharset186\fprq2 Times New Roman Baltic;}{\f167\fswiss\fcharset23
8\fprq2 Arial CE;}{\f168\fswiss\fcharset204\fprq2 Arial Cyr;}{\f170\fswiss\fchar
set161\fprq2 Arial Greek;}{\f171\fswiss\fcharset162\fprq2 Arial Tur;}
{\f174\fswiss\fcharset186\fprq2 Arial Baltic;}}{\colortbl;\red0\green0\blue0;\re
d0\green0\blue255;\red0\green255\blue255;\red0\green255\blue0;\red255\green0\blu
e255;\red255\green0\blue0;\red255\green255\blue0;\red255\green255\blue255;\red0\
green0\blue128;
\red0\green128\blue128;\red0\green128\blue0;\red128\green0\blue128;\red128\green
0\blue0;\red128\green128\blue0;\red128\green128\blue128;\red192\green192\blue192
;}{\stylesheet{\ql \li0\ri0\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\li
n0\itap0
\fs24\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 \snext0 Normal;}{\*\cs10
 \additive Default Paragraph Font;}}\widowctrl\ftnbj\aenddoc\noxlattoyen\expshrt
n\noultrlspc\dntblnsbdb\nospaceforul\formshade\horzdoc\dgmargin\dghspace180\dgvs
pace180
\dghorigin1701\dgvorigin1984\dghshow1\dgvshow1\jexpand\pgbrdrhead\pgbrdrfoot\spl
ytwnine\ftnlytwnine\htmautsp\nolnhtadjtbl\useltbaln\alntblind\lytcalctblwd\lyttb
lrtgr\lnbrkrule \fet0\sectd \linex0\endnhere\sectlinegrid360\sectdefaultcl {\*\p
nseclvl1
\pnucrm\pnstart1\pnindent720\pnhang{\pntxta .}}{\*\pnseclvl2\pnucltr\pnstart1\pn
indent720\pnhang{\pntxta .}}{\*\pnseclvl3\pndec\pnstart1\pnindent720\pnhang{\pnt
xta .}}{\*\pnseclvl4\pnlcltr\pnstart1\pnindent720\pnhang{\pntxta )}}{\*\pnseclvl
5
\pndec\pnstart1\pnindent720\pnhang{\pntxtb (}{\pntxta )}}{\*\pnseclvl6\pnlcltr\p
nstart1\pnindent720\pnhang{\pntxtb (}{\pntxta )}}{\*\pnseclvl7\pnlcrm\pnstart1\p
nindent720\pnhang{\pntxtb (}{\pntxta )}}{\*\pnseclvl8\pnlcltr\pnstart1\pnindent7
20\pnhang
{\pntxtb (}{\pntxta )}}{\*\pnseclvl9\pnlcrm\pnstart1\pnindent720\pnhang{\pntxtb
(}{\pntxta )}}\pard\plain \ql \li0\ri0\widctlpar\aspalpha\aspnum\faauto\adjustri
ght\rin0\lin0\itap0 \fs24\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 {\f1
\fs40 Testing

\par Testing
\par Testing
\par
\par }}

D:\Source>GetClipboardData 1
Clipboard Data:
Testing
Testing
Testing
0
 

Author Comment

by:trovatore
ID: 6963863
Thanks, gcauthon.  I was pretty much set before but it's good to have this info there on the record.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In the absence of a fully-fledged GPO Management product like AGPM, the script in this article will provide you with a simple way to watch the domain (or a select OU) for GPOs changes and automatically take backups when policies are added, removed o…
By default Outlook 2016 displays only one time zone in the Calendar. The following article explains how to display two time zones in one calendar view.
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

722 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question