AceText Clipboard Format

The information below is intended for programmers who want to make their software AceText-aware.

The minimum requirement for an application to be AceText-aware, it to recognize AceText's clipboard format. Then the application can paste AceText's clips and receive them via drag-and-drop the way the user expects. Download the AceText Client Demos to get sample source code that you can use as the basis for your own applications. One demo is written in C# using the .NET framework, and the other is written in Delphi using the Win32 API.

AceText places clips on the clipboard as a UTF-8 string holding an XML structure, according to the XML schema at http://www.acetext.com/acetext20.xsd. The structure is designed with both backward and forward compatibility in mind. For maximum compatibility, if your application encounters a clip with a version attribute in the acetext tag with a value greater than that defined in the XML schema, it should silently ignore any elements and attributes that are not defined in the schema.

When a single clip is copied to the clipboard, the string used to identify the clipboard format is "AceText Clip". Use this string when calling the Win32 API function RegisterClipboardFormat(), or when calling the GetData() and GetDataPresent() methods of the IDataObject interface in the .NET framework. The clipboard contents will be a UTF-8 string holding an XML file with a single clip element of type Clip in the acetext root element, as defined in the XML schema. An example:

<?xml version="1.0" encoding="UTF-8"?>
<act:acetext xmlns:act="http://www.acetext.com/acetext20.xsd" version="2.0">
   <clip kind="text" label="Clip Label" acetype="abbreviation" date="2006-06-12T16:21:07">
       <text>Text of the clip copied to the clipboard</text>
   </clip>
</act:acetext>

When the user copies multiple clips to the clipboard, AceText also places the "AceText Clip" format on the clipboard. It will contain the clip that was visible in AceText when the clips were copied. If your application is unable to paste multiple clips, it should paste this clip.

AceText will also place the "AceText Collection" format on the clipboard. The data for this format is also an UTF-8 string with XML data. The acetext root element will contain one collection element of type Collection, as defined in the XML schema. This is the exact same format used by .atc files when AceText saves a collection into a file. An example:

<?xml version="1.0" encoding="UTF-8"?>
<act:acetext xmlns:act="http://www.acetext.com/acetext20.xsd" version="2.0">
   <collection sort="none">
       <clip kind="text" label="Clip Label" acetype="abbreviation" date="2006-06-12T16:21:07">
           <text>Text of the clip copied to the clipboard</text>
       </clip>
       <folder label="More clips" sort="old-new">
           <clip kind="beforeafter" label="Before &amp; after clip" date="2006-06-12T16:28:13">
               <before>Before text</before>
               <after>After text</after>
           </clip>
           <clip kind="binary" label="Binary clip" date="2006-06-12T16:28:40">
               <bytes>DEADBEEF</bytes>
           </clip>
       </folder>
   </collection>
</act:acetext>