Hi,

 

  Very interesting your code.

 

  First you should take a look at:

 

http://msdn.microsoft.com/en-us/library/windows/desktop/ms649015(v=vs.85).as
px

and

http://blogs.msdn.com/b/jmstall/archive/2007/01/21/sample-code-html-clipboar
d.aspx

 

Then notice from the documentation that the format string must be "HTML
Format". 

 

Then doing 

 

Clipboard.text

And 

clipboard.formatdata

 

  Will make the first call to be replaced by the second call. Because
internally IUP is clearing the clipboard before setting the data. This is
something I have to improve. Although maybe it is not necessary because the
windows clipboard has an automatic conversion between know formats. Must
check this when we have a working version. 

 

  So just this should do the job:

 

clipboard = iup:clipboard()

clipboard.addformat = 'HTML Format'

clipboard.format = 'HTML Format'

clipboard.formatdatasize = htmltemplate:len()+1

clipboard.formatdata = htmltemplate

 

  Just noticed that htmltemplate should a valid UTF-8 string. For the given
sample is fine.

 

  Then, there is a small mistake at the end of the string sample where there
are duplicated </body> and </html> tags.

 

  Ok. Then I still didn't have time to fully understand how the offsets are
computed for the header. The second link I sent you should help.  I'm at
Tecgraf with several meetings schedules for this week, so can't help you
more than that. But I`m very interested in making this work.

 

Best,

Scuri

 

 

From: Jane Taubman [mailto:[email protected]] 
Sent: quarta-feira, 5 de dezembro de 2012 8:57
To: IUP discussion list.
Subject: [Iup-users] iup,clipboard - creating an html clip

 

I am currently using IUP with Lua on a windows system.

What I would like to do, is load the clipboard with a set of html text so
that when it's pasted to another program, it is formatted correctly.

 

At the moment I have tried "HTML" and "CF_HTML" in the format fields,  but
when the text is pasted in to Evernote it appears as the original text.

 

I have tried to follow the instructions on the help page,  but as I have
only ever written text to the clipboard previously realise I am probably
doing completely the wrong method.

 

When I review the contents in the clipboard viewer only the text version is
registered.

 

Any help appreciated.

 

 

 

htmltemplate = [[

Version:0.9

    StartHTML:71

    EndHTML:170

    StartFragment:140

    EndFragment:160

    StartSelection:140

    EndSelection:160

    <!DOCTYPE>

    <HTML>

    <HEAD>

    <TITLE> The HTML Clipboard</TITLE>

    <BASE HREF="http://sample/specs";>

    </HEAD>

    <BODY>

    <UL>

    <!--StartFragment -->

    <LI> The Fragment </LI>

    <!--EndFragment -->

    </UL>

    </BODY>

    </HTML>

</body>

</html>

]]

 

clipboard = iup:clipboard()

clipboard.format = 'HTML'

clipboard.text = striptags(htmltemplate)

clipboard.FORMATDATASIZE = htmltemplate:len()

clipboard.FORMATDATA = htmltemplate

 

 

 

 

Thanks in advance.

 

-- 
Jane.

Jane Taubman | www.rjt.org.uk | www.taubman.org.uk |www.fhug.org.uk

------------------------------------------------------------------------------
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
_______________________________________________
Iup-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/iup-users

Reply via email to