Bryant Likes's Blog

It's all about WebData

Recent Posts

Tags

News


  • Windows Live Alerts
    View Bryant Likes's profile on LinkedIn

    Me

    The posts on this weblog are provided "as is" with no warranties and confer no rights. The opinions expressed herin are the personal opinions of the individual authors and do not represent the views of Avanade in any way.

Community

Email Notifications

Archives

Clipboard Paste Live Writer Plugin

If you copy source as html (or have any html in the clipboard), hitting paste in Windows Live Writer pastes the text without the markup. So since there is an SDK and some great samples, I went ahead and wrote a simple plugin to paste the clipboard contents as html (in about 10 minutes).

public override DialogResult CreateContent(IWin32Window dialogOwner, ref string newContent)
        {
            DialogResult result = DialogResult.OK;
            if (Clipboard.ContainsText() == true)
            {
                newContent = Clipboard.GetText();
            }
            else
            {
                result = MessageBox.Show(dialogOwner, "Copy your HTML to the clipboard.", "Paste as Html", MessageBoxButtons.OKCancel);
                if (result == DialogResult.OK && Clipboard.ContainsText() == true)
                {
                    newContent = Clipboard.GetText();
                }
            }
 
            return result;
        }

I've applied to join the CodePlex project so maybe my humble contribution will get added, but for now you can download it here.

Technorati Tags: -

Posted: 08-18-2006 2:55 AM by bryantlikes | with 6 comment(s)
Filed under: ,

Comments

Laurent Kempé said:

Nice :)

I planned to do it, but if it si done :)

Great.

Regards

Laurent

# August 18, 2006 1:21 AM

Live Writer Plugins said:

Nice! Can I keep it in Live Writer Plugins website so that other Live Writer users can use it ? Thanks!

# August 27, 2006 7:06 PM

bryantlikes said:

Sure!

# August 28, 2006 12:14 PM

Spike Washburn (Writer Dev Team) said:

Humble it may be, but also quite useful.  The way Writer handles pastes from VS is one of the top complaints we get from MS developers. I'm glad to see you found a clever workaround to take some heat off of us ;-)

I hope you'll consider posting it to the Windows Live Writer plugin gallery.

http://writerdevzone.spaces.live.com/blog/cns!FF912D98C958E9D3!106.entry

# August 28, 2006 3:37 PM

William said:

Thanks Brain. Just what I needed. I do get some funky spaceing however as shown here:

http://staceyw.spaces.live.com/blog/cns!F4A38E96E598161E!933.entry

It looks fine when posted into LW and in LW Preview, but when seen on the real site, it adds spaces. Any ideas?  TIA!

# August 31, 2006 1:10 PM

William said:

Thanks for your post on my blog.  I am still having the same issue.  Maybe it is because I am using CopyAsHtml 2.0?  If you ever upgrade and see this issue yourself, please drop me a comment.  Thanks again Bryant!

# September 1, 2006 10:33 AM
Leave a Comment

(required) 

(required) 

(optional)

(required)