Critical Development

Language design, framework development, UI design, robotics and more.

Archive for the ‘Blogging’ Category

OneNote to Live Writer: Copying Text and Graphics

Posted by Dan Vanderboom on September 18, 2010

Blogging Blues

I’ve been using Microsoft Live Writer since shoftly after starting my blog in 2007.  I can’t call it awesome by any stretch of the imagination, but it’s the least painful option that I’ve found so far.  Having to paste images of screenshots of code, and having to change multiple image properties on different property pages for every single screenshot I paste into an article is grueling, as is having to dig through menus just to change font size or color.  The newer versions have a nice ribbon control which exposes font settings, but the auto-update feature didn’t work on the version I was using, so I was using an old version for way too long.

Upon upgrading to the 2011 beta of Live Writer, I noticed I could no longer paste an image into a post by using the familiar Control-V.  Just as I was about to give up on Live Writer altogether, someone pointed me to Clipboard Live, which allows you to paste images once again, however by pressing a button on one of the ribbon menu pages instead of the more familiar Control-V paste command.

I work in OneNote quite a bit to take notes, and especially when working on language design for Archetype, since OneNote makes formatting and colorizing code fairly easy.  But getting that formatted text from OneNote to Live Writer is another story.

I decided to experiment a little.  Copying and pasting from OneNote to Live Writer stripped all of the color and formatting away, but going from OneNote to Word actually preserved them.  I remembered seeing some blog publishing settings in Word, so I published my formatted text from there to see how well it worked.  Despite Word’s excellent ability to work with text formatting in general, I was quite disappointed to encounter two major flaws:

  1. Ending a line with a carriage return translated into an “end of paragraph” character in Word. Although it displayed fine in Word, on my blog it added extra spacing between “paragraphs”.
  2. Changing paragraph endings with Shift-Enter (whatever that’s called) didn’t work either, because all lines of text so separated had to exist at the same level of indentation.
  3. Lines of text which were very short (30-50 characters) were often word-wrapped and continued on the next line on the web page, though such was not the case in Word.

This effectively renders Word useless to me as blogging software, except to take part in the work-around hack I describe below.

There seems to be no such thing yet as WYSIWYG (What You See Is What You Get) between thick client applications and the web, or even between two thick-client applications when it comes to rich text formatting.

The Workaround

But worry not, because there is a way, ugly as it is!

First you’ll need to install Clipboard Live, a plugin for Live Writer, which you can download here.

Here’s what you do:

  1. Copy your colorized and/or formatted text from OneNote.
  2. Paste into Microsoft Word.
  3. Copy the same text from Word.
  4. Switch to Live Writer, and in the Insert ribbon menu, click on Clipboard Live.

Your text will appear in all its formatted glory.

Images can be pasted using Clipboard Live as well, but they don’t require using Word as an intermediary.

Example

IStream<TItem> : IStream

{

Length long;

Head StreamItem<TItem>;

Tail StreamItem<TItem>;

ChildStreams IStream<TItem>*;

ReadingIdleDuration TimeSpan;

WritingIdleDuration TimeSpan;

 

Append(Item TItem); // make Item the new Tail

Inject(Item TItem); // make Item the new Head

Inject(Item TItem, Index int); // insert in the middle; indexed from the front

 

Peek(Index int) TItem;

Extract(Index int) TItem;

Extract(Index int, Count int) TItem;

Read(Count int) TItem*; // extract from the front

Read() TItem; // extract the Head

}

 

Now the code appearing in my articles will be text instead of images. Much better.

Happy blogging!

Posted in Blogging | Tagged: , , , , | 3 Comments »