StandardDataFormats.Html StandardDataFormats.Html StandardDataFormats.Html StandardDataFormats.Html StandardDataFormats.Html Property


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

public : static Platform::String Html { get; }
static winrt::hstring Html();
public static string Html { get; }
Public Shared ReadOnly Property Html As string
var string = Windows.ApplicationModel.DataTransfer.StandardDataFormats.html;

Property Value

string string string

The format ID string value corresponding to the HTML format.


This example demonstrates the use of the Html property. To use the code in this example, add an event listener to your app to handle the activated event. Then put this code in the function that this event listener calls.

public void ShareSourceLoad()
    DataTransferManager dataTransferManager = DataTransferManager.GetForCurrentView();
    dataTransferManager.DataRequested += new TypedEventHandler<DataTransferManager, DataRequestedEventArgs>(this.DataRequested);

async void DataRequested(DataTransferManager sender, DataRequestedEventArgs e)
    string htmlExample = "<p>Here is our store logo: <img src='assets/logo.png'>.</p>";
    string fileExample = "assets\\logo.png";
    RandomAccessStreamReference streamRef = null;
    Windows.Storage.StorageFile file = await Windows.ApplicationModel.Package.Current.InstalledLocation.GetFileAsync(fileExample);
        streamRef = Windows.Storage.Streams.RandomAccessStreamReference.CreateFromFile(file);
    catch (Exception ex)
        // TODO: Handle the exception.
    string htmlFormat = Windows.ApplicationModel.DataTransfer.HtmlFormatHelper.CreateHtmlFormat(htmlExample);
    DataRequest request = e.Request;
    request.Data.Properties.Title = "Share HTML Example";
    request.Data.Properties.Description = "An example of how to share HTML.";
    request.Data.ResourceMap[fileExample] = streamRef;
function shareHtmlHandler(e) {
    var request = e.request;
    var htmlExample = "<p>Here is our store logo: <img src='images/logo.png'>.</p>";
    var localImage = "images\\logo.png"; = "Share Html Example"; = "A demonstration that shows how to share an HTML fragment with a local image.";
    var deferral = e.request.getDeferral();
    Windows.ApplicationModel.Package.current.installedLocation.getFileAsync(localImage).done(function (imageFile) {;[localImage] = Windows.Storage.Streams.RandomAccessStreamReference.createFromFile(imageFile);
    }, function (err) {