eDocEngine VCL
Create documents and reports in 18 formats
Delphi C++Builder

Programming the Windows Clipboard using eDocEngine

Learn how to use the clipboard engine.
By Ashwini

The Windows clipboard allows you to temporarily store content in formats such as text, bitmap, metafile, and wave.

eDocEngine's gtClipboard class supports text, Software Arts' Data Interchange Format (used in VisiCalc), Microsoft's Symbolic Link (SYLK) format, bitmap, Windows Metafile (WMF), and Enhanced Metafile (EMF).

After you create a gtClipboard object, you can add elements such as text, images, shapes, tables, watermarks and stamps to it. The elements supported by the format will be copied to the Windows clipboard.

After the content has been copied to the Windows clipboard in a particular format, you can open any application that supports that format, open a new document, and do a "Paste" operation. The Windows clipboard contents will be copied to the document right away!

To illustrate this, here is a small application that places some text and an image into the clipboard in a given format.

After the button is clicked, you can open an image-editing application and do the "Paste" operation.

And, here is the code snippet where all the action is.

  TForm1 = class(TForm)
    // The "Copy to Clipboard" button
    Button1: TButton;
    // eDocEngine Clipboard engine component
    gtClipboard1: TgtClipboard;
    OpenDialog1: TOpenDialog;
    GroupBox1: TGroupBox;
    Label1: TLabel;
    Memo1: TMemo;
    // The "Load a picture" button
    Button2: TButton;
    // The "Select the output format" list
    ComboBox1: TComboBox;
    Label2: TLabel;
    Shape1: TShape;
    Image1: TImage;

procedure TForm1.Button1Click(Sender: TObject);
  LStr: String;
  LStr := Memo1.Lines.Text;

  case ComboBox1.ItemIndex of
    0: gtClipboard1.OutputFormat := ofText;
    1: gtClipboard1.OutputFormat := ofSYLK;
    2: gtClipboard1.OutputFormat := ofDIF;
    3: gtClipboard1.OutputFormat := ofBMP;
    4: gtClipboard1.OutputFormat := ofMetafile;

  // Use the clipboard engine component
  with gtClipboard1 do
        // Write the text
        // Render the selected image
        DrawImage(1, 1, Image1.Picture.Graphic);

// Allow the user select an image and display it
// on the form
procedure TForm1.Button2Click(Sender: TObject);
  if OpenDialog1.Execute then



Our .NET Developer Tools
Gnostice Document Studio .NET

Multi-format document-processing component suite for .NET developers.


A .NET PDF component suite to create, edit, view, print, reorganize, encrypt, annotate, and bookmark PDF documents in .NET applications.

Our Delphi/C++Builder developer tools
Gnostice Document Studio Delphi

Multi-format document-processing component suite for Delphi/C++Builder developers, covering both VCL and FireMonkey platforms.

eDocEngine VCL

A Delphi/C++Builder component suite for creating documents in over 20 formats and also export reports from popular Delphi reporting tools.

PDFtoolkit VCL

A Delphi/C++Builder component suite to edit, enhance, view, print, merge, split, encrypt, annotate, and bookmark PDF documents.

Our Java developer tools
XtremeDocumentStudio (for Java)

Multi-format document-processing component suite for Java developers.

PDFOne (for Java)

A Java PDF component suite to create, edit, view, print, reorganize, encrypt, annotate, bookmark PDF documents in Java applications.

Our Platform-Agnostic Cloud and On-Premises APIs

Cloud-hosted and On-Premises REST-based document-processing and document-viewing APIs

Privacy | Legal | Feedback | Newsletter | Blog | Resellers © 2002-2019 Gnostice Information Technologies Private Limited. All rights reserved.