Solved

Format of CF_RTFTEXT clipboard data

Posted on 2002-04-22
4
991 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
  • 2
4 Comments
 
LVL 63

Expert Comment

by:SysExpert
Comment Utility
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
Comment Utility
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 200 total points
Comment Utility
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
Comment Utility
Thanks, gcauthon.  I was pretty much set before but it's good to have this info there on the record.
0

Featured Post

Do email signature updates give you a headache?

Do you feel like all of your time is spent managing email signatures? Too busy to visit every user’s desk to make updates? Want high-quality HTML signatures on all devices, including on mobiles and Macs? Then, let Exclaimer solve all your email signature problems today!

Join & Write a Comment

For a variety of reasons, it sometimes makes sense to reboot a Windows-based computer on a regular, perhaps daily basis. This "cures" a lot of ills by resetting processes, flushing caches, refreshing memory, and reestablish network connections. In a…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
In this video, we discuss why the need for additional vertical screen space has become more important in recent years, namely, due to the transition in the marketplace of 4x3 computer screens to 16x9 and 16x10 screens (so-called widescreen format). …
The viewer will learn how to successfully create a multiboot device using the SARDU utility on Windows 7. Start the SARDU utility: Change the image directory to wherever you store your ISOs, this will prevent you from having 2 copies of an ISO wit…

771 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now