Home » U++ Library support » U++ Library : Other (not classified elsewhere) » [FEATURE + patch]WriteClipboardHTML and HtmlToText functions
Re: [FEATURE + patch]WriteClipboardHTML and HtmlToText functions [message #51380 is a reply to message #51306] |
Sun, 17 March 2019 10:44 |
|
mirek
Messages: 13984 Registered: November 2005
|
Ultimate Member |
|
|
Both functions are handy, but I am undecided about HtmlToText.
Also, I was feeling a little bit uneasy about possiblity of <HTML> string (or that marker comment) being inside html, so I have slightly changed the function to:
void WriteClipboardHTML(const String& html)
{
String data;
data =
"Version:0.9\n"
"StartHTML:#000001#\n"
"EndHTML:#000002#\n"
"StartFragment:#000003#\n"
"EndFragment:#000004#\n"
"StartSelection:#000003#\n"
"EndSelection:#000004#\n"
"<HTML>\n"
"<!--StartFragment -->"
"<!--EndFragment -->\n"
"</HTML>\n"
;
data.Replace("#000001#", Sprintf("%08u", data.Find("<HTML>") + 6));
int start = data.Find("<!--StartFragment -->") + 21;
data.Replace("#000003#", Sprintf("%08u", start));
data.Replace("#000004#", Sprintf("%08u", data.Find("<!--EndFragment -->") + html.GetCount()));
data.Replace("#000002#", Sprintf("%08u", data.Find("</HTML>") + html.GetCount()));
data.Insert(start, html);
WriteClipboard("HTML Format", data);
}
In this form, I am adding this to CtrlCore.
Mire
[Updated on: Sun, 17 March 2019 10:45] Report message to a moderator
|
|
|
Goto Forum:
Current Time: Wed Jun 05 06:49:25 CEST 2024
Total time taken to generate the page: 0.01971 seconds
|