HtmlFormatHelper.CreateHtmlFormat | createHtmlFormat method
Takes a string that represents HTML content and adds the necessary headers to ensure it is formatted correctly for share and Clipboard operations.
Syntax
var string = Windows.ApplicationModel.DataTransfer.HtmlFormatHelper.createHtmlFormat(htmlFragment);
Parameters
- htmlFragment
-
Type: String [JavaScript] | System.String [.NET] | Platform::String [C++]
A string representing the HTML content.
Return value
Type: String [JavaScript] | System.String [.NET] | Platform::String [C++]
A string representing the formatted HTML.
Examples
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"; request.data.properties.title = "Share Html Example"; request.data.properties.description = "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) { request.data.setHtmlFormat(Windows.ApplicationModel.DataTransfer.HtmlFormatHelper.createHtmlFormat(htmlExample)); request.data.resourceMap[localImage] = Windows.Storage.Streams.RandomAccessStreamReference.createFromFile(imageFile); deferral.complete(); }, function (err) { request.failWithDisplayText(err); }); }
Requirements
|
Minimum supported client | Windows 8 |
|---|---|
|
Minimum supported server | Windows Server 2012 |
|
Namespace |
|
|
Metadata |
|
See also
Build date: 2/25/2013
