DataPackageView.GetHtmlFormatAsync Méthode
Définition
Important
Certaines informations portent sur la préversion du produit qui est susceptible d’être en grande partie modifiée avant sa publication. Microsoft exclut toute garantie, expresse ou implicite, concernant les informations fournies ici.
Obtient le code HTML stocké dans l’objet DataPackageView .
public:
virtual IAsyncOperation<Platform::String ^> ^ GetHtmlFormatAsync() = GetHtmlFormatAsync;
/// [Windows.Foundation.Metadata.RemoteAsync]
IAsyncOperation<winrt::hstring> GetHtmlFormatAsync();
[Windows.Foundation.Metadata.RemoteAsync]
public IAsyncOperation<string> GetHtmlFormatAsync();
function getHtmlFormatAsync()
Public Function GetHtmlFormatAsync () As IAsyncOperation(Of String)
Retours
The HTML.
- Attributs
Exemples
if (shareOperation.data.contains(Windows.ApplicationModel.DataTransfer.StandardDataFormats.html)) {
document.getElementById("htmlContentArea").className = "unhidden";
shareOperation.data.getHtmlFormatAsync().then(function (html) {
if (html !== null) {
var htmlFragment = Windows.ApplicationModel.DataTransfer.HtmlFormatHelper.getStaticFragment(htmlFormat);
// Set the innerHTML of the ifram to the HTML fragment.
var iFrame = document.getElementById("htmlContent");
iFrame.style.display = "";
iFrame.contentDocument.documentElement.innerHTML = htmlFragment;
}
});
// Loop through any images and use the resourceMap to map each image element's src.
var images = iFrame.contentDocument.documentElement.getElementsByTagName("img");
if (images.length > 0) {
shareOperation.data.getResourceMapAsync().done(function (resourceMap) {
if (resourceMap.size > 0) {
for (var i = 0, len = images.length; i < len; i++) {
var streamReference = resourceMap[images[i].getAttribute("src")];
if (streamReference) {
// Call a helper function to map the image element's src to a corresponding blob URL generated from the streamReference
setResourceMapURL(streamReference, images[i]);
}
}
}
});
}
//shareOperation.reportCompleted();
S’applique à
Commentaires
https://aka.ms/ContentUserFeedback.
Bientôt disponible : Tout au long de 2024, nous allons supprimer progressivement GitHub Issues comme mécanisme de commentaires pour le contenu et le remplacer par un nouveau système de commentaires. Pour plus d’informations, consultezEnvoyer et afficher des commentaires pour