Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
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 Go to previous messageGo to previous message
mirek is currently offline  mirek
Messages: 13975
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

 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: curl
Next Topic: How to detect available OpenGL memory?
Goto Forum:
  


Current Time: Wed Apr 24 15:13:10 CEST 2024

Total time taken to generate the page: 0.02464 seconds