Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>OK, so the answer seem to be no! which surprised me some... </p> <p>Anyway. I made my own helper class which maybe can help you to. This is only one of many possible solutions. For my application it works nice to return null if nothing is found, maybe you want an exception instead. Also keep in mind that I am making this as a side project, so there are no extensive testing of the code, and therefore <strong>I make NO guarantees that this works</strong>.</p> <pre><code>public class ClipboardHtmlOutput { public Double Version { get; private set; } public String Source { get; private set; } public String Input { get; private set; } //public String Html { get { return Input.Substring(startHTML, (endHTML - startHTML)); } } public String Html { get { return Input.Substring(startHTML, Math.Min(endHTML - startHTML, Input.Length - startHTML)); } } public String Fragment { get { return Input.Substring(startFragment, (endFragment - startFragment)); } } private int startHTML; private int endHTML; private int startFragment; private int endFragment; public static ClipboardHtmlOutput ParseString(string s) { ClipboardHtmlOutput html = new ClipboardHtmlOutput(); string pattern = @"Version:(?&lt;version&gt;[0-9]+(?:\.[0-9]*)?).+StartHTML:(?&lt;startH&gt;\d*).+EndHTML:(?&lt;endH&gt;\d*).+StartFragment:(?&lt;startF&gt;\d+).+EndFragment:(?&lt;endF&gt;\d*).+SourceURL:(?&lt;source&gt;f|ht{1}tps?://[-a-zA-Z0-9@:%_\+.~#?&amp;//=]+)"; Match match = Regex.Match(s, pattern, RegexOptions.Singleline); if (match.Success) { try { html.Input = s; html.Version = Double.Parse(match.Groups["version"].Value, CultureInfo.InvariantCulture); html.Source = match.Groups["source"].Value; html.startHTML = int.Parse(match.Groups["startH"].Value); html.endHTML = int.Parse(match.Groups["endH"].Value); html.startFragment = int.Parse(match.Groups["startF"].Value); html.endFragment = int.Parse(match.Groups["endF"].Value); } catch (Exception fe) { return null; } return html; } return null; } } </code></pre> <p>Usage could be something like this:</p> <pre><code>IDataObject iData = Clipboard.GetDataObject(); if (iData.GetDataPresent(DataFormats.Html)) { ClipboardHtmlOutput cho = ClipboardHtmlOutput.ParseString((string)iData.GetData(DataFormats.Html)); XmlDocument xml = new XmlDocument(); xml.LoadXml(cho.Fragment); } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload