StandardDataFormats StandardDataFormats StandardDataFormats StandardDataFormats StandardDataFormats Class

Definition

Some information relates to pre-released product which may be substantially modified before it’s commercially released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

Prerelease APIs are identified by a Prerelease label.

[Contains prerelease APIs.]
Contains static properties that return string values. Each string corresponds to a known format ID. Use this class to avoid errors in using string constants to specify data formats.

public : static class StandardDataFormats
static struct winrt::Windows::ApplicationModel::DataTransfer::StandardDataFormats
public static class StandardDataFormats
Public Static Class StandardDataFormats
// This class does not provide a public constructor.
Attributes
Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Examples

This example shows how to retrieve shared text.

var shareOperation = eventObject.detail.shareOperation;
if (shareOperation.data.contains(Windows.ApplicationModel.DataTransfer.StandardDataFormats.text)) {
    shareOperation.data.getTextAsync().done(function (text) {
            // To output the text using this example, 
            // you need a div tag with an id of "output" in your HTML file.
            document.getElementById("output").innerText = text;
        }, function (e) {
            displayError("Error retrieving Text format: " + e);
        }
    });
}

Remarks

The DataPackage class supports several format types. Whenever you need to specify a format, we recommend using the properties of the StandardDataFormats class, instead of string values. Doing so ensures consistency between source and target applications.

The DataPackage class supports a number of legacy formats for interoperability between UWP app and desktop apps. To retrieve these formats, you pass one of the following strings to the DataPackageView.GetDataAsync method instead of a value from the StandardDataFormats class.

If format name is:GetDataAsync() retrieves:
"AnsiText"String for CF_TEXT.
"DeviceIndependentBitmap"Stream for HGLOBAL corresponding to CF_DIB.
"DeviceIndependentBitmapV5"Stream for HGLOBAL corresponding to CF_DIBV5.
"DataInterchangeFormat"Stream for HGLOBAL corresponding to CF_DIF.
"EnhancedMetafile"Stream for HENHMETAFILE corresponding to CF_ENHMETAFILE.
"Locale"Stream for HGLOBAL corresponding to CF_LOCALE
"OEMText"String for CF_OEMTEXT.
"PenData"Stream for HGLOBAL corresponding to CF_PENDATA
"RiffAudio"Stream for HGLOBAL corresponding to CF_RIFF.
"SymbolicLink"Stream for HGLOBAL corresponding to CF_SYLK.
"TaggedImageFileFormat"Stream for HGLOBAL corresponding to CF_TIFF.
"WaveAudio"Stream for HGLOBAL corresponding to CF_WAVE.

The Windows Runtime provides limited support for metafiles. Specifically, the Windows Runtime:

  • Supports rendering metafiles, but not creating them.
  • Supports the CF_ENHMETAFILE format ("EnhancedMetafile"), but not CF_METAFILEPICT.
  • Supports requesting data in "EnhancedMetafile" format, but not providing it; that is, calling SetData("EnhancedMetafile", <data>) won't work.
  • Provides limited support through the clipboard API for exchanging metafiles between UWP app and desktop apps.

Properties

ApplicationLink ApplicationLink ApplicationLink ApplicationLink ApplicationLink

A read-only property that returns the format ID string value corresponding to the activation link format.

Bitmap Bitmap Bitmap Bitmap Bitmap

A read-only property that returns the format ID string value corresponding to the Bitmap format.

Html Html Html Html Html

A read-only property that returns the format ID string value corresponding to the HTML format.

Rtf Rtf Rtf Rtf Rtf

A read-only property that returns the format ID string value corresponding to the Rich Text Format (RTF).

StorageItems StorageItems StorageItems StorageItems StorageItems

A read-only property that returns the format ID string value corresponding to the StorageItem format.

Text Text Text Text Text

A read-only property that returns the format ID string value corresponding to the Text format.

Uri Uri Uri Uri Uri

Note

Uri may be altered or unavailable for releases after Windows 8.1. Instead, use ApplicationLink or WebLink.

A read-only property that returns the format ID string value corresponding to the Uniform Resource Identifier (URI) format.

WebLink WebLink WebLink WebLink WebLink

A read-only property that returns the format ID string value corresponding to the web link format.