1. Win32lib ListView to clipBoard & Excel
- Posted by serdem at polinas.com.tr Jul 12, 2004
- 621 views
This is a multipart message in MIME format. --=_alternative 0022CB6CC2256ECF_= Content-Type: text/plain; charset="us-ascii" Hi friends, I'm trying to copy selected listview rows to windows clipboard in order to paste to an MS Excel sheet. In my eu pgm I used a hidden editbox as a buffer and did copy() to achieve this. But I don't know how to format listview rows and columns for properly paste to excel rows and columns. Best regards, thanks. Serdar Erdem --=_alternative 0022CB6CC2256ECF_= Content-Type: text/html; charset="us-ascii" <br><font size=2 face="sans-serif">Hi friends,</font> <br> <br><font size=2 face="sans-serif">I'm trying to copy selected listview rows to windows clipboard in order to paste to an MS Excel sheet.</font> <br><font size=2 face="sans-serif">In my eu pgm I used a hidden editbox as a buffer and did copy() to achieve this. </font> <br><font size=2 face="sans-serif">But I don't know how to format listview rows and columns for properly paste to excel rows and columns.</font> <br> <br><font size=2 face="sans-serif">Best regards, thanks.</font> <br> <br><font size=2 face="sans-serif">Serdar Erdem</font> <br> --=_alternative 0022CB6CC2256ECF_=--
2. Re: Win32lib ListView to clipBoard & Excel
- Posted by Tommy Carlier <tommy.carlier at pandora.be> Jul 12, 2004
- 574 views
What you can do is copy it as an HTML-table. That way, you can paste it in Excel, Word, Outlook or any other program that supports HTML-clipboard code. However, it's a bit tricky to copy data to the clipboard in HTML-form. I had to do it at work (in C#), and it worked, but it took me a while to figure it out (not many complete answers on the web). I'll copy&paste the C#-code here, and try to provide a Euphoria-version later (I'm at work now, working ;) ). public static void wfcHtmlToClipBoardCopy(string aHtml) { // copies an HTML-fragment to the clipboard Encoding lEncoding = Encoding.UTF8; string lBeginHtml = "<html>\r\n<head>\r\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=" + lEncoding.WebName + "\">\r\n</head>\r\n<body>\r\n<!--StartFragment-->"; string lBegin = "Version:0.9\r\nStartHTML:{0:000000}\r\nEndHTML:{1:000000}\r\nStartFragment:{2:000000}\r\nEndFragment:{3:000000}\r\n"; string lEndHtml = "<!--EndFragment-->\r\n</body>\r\n</html>\r\n"; int lBeginCount = lEncoding.GetByteCount(lBegin); int lBeginHtmlCount = lEncoding.GetByteCount(lBeginHtml); int lAHtmlCount = lEncoding.GetByteCount(aHtml); int lEndHtmlCount = lEncoding.GetByteCount(lEndHtml); string lHtml = String.Format(lBegin , lBeginCount // StartHtml , lBeginCount + lBeginHtmlCount + lAHtmlCount + lEndHtmlCount // EndHtml , lBeginCount + lBeginHtmlCount // StartFragment , lBeginCount + lBeginHtmlCount + lAHtmlCount // EndFragment ) + lBeginHtml + aHtml + lEndHtml; DataObject lObject = new DataObject(); lObject.SetData(DataFormats.Html, new System.IO.MemoryStream(lEncoding.GetBytes(lHtml))); Clipboard.SetDataObject(lObject, true); } -- tommy online: http://users.pandora.be/tommycarlier Euphoria Message Board: http://uboard.proboards32.com
3. Re: Win32lib ListView to clipBoard & Excel
- Posted by Tommy Carlier <tommy.carlier at pandora.be> Jul 12, 2004
- 608 views
Sorry about that, the C#-code got totally messed-up. You can find it at http://groups.google.com/groups?selm=e33f09ac.0307240200.7918307c%40posting.google.com&rnum=1 -- tommy online: http://users.pandora.be/tommycarlier Euphoria Message Board: http://uboard.proboards32.com