The Artima Developer Community
Sponsored Link

.NET Buzz Forum
Pasting nicely formatted code into your blog

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Roy Osherove

Posts: 1807
Nickname: royo
Registered: Sep, 2003

Roy Osherove is a .Net consultant based in Israel
Pasting nicely formatted code into your blog Posted: Feb 5, 2004 4:39 AM
Reply to this message Reply

This post originated from an RSS feed registered with .NET Buzz by Roy Osherove.
Original Post: Pasting nicely formatted code into your blog
Feed Title: ISerializable
Feed URL: http://www.asp.net/err404.htm?aspxerrorpath=/rosherove/Rss.aspx
Feed Description: Roy Osherove's persistent thoughts
Latest .NET Buzz Posts
Latest .NET Buzz Posts by Roy Osherove
Latest Posts From ISerializable

Advertisement
BTW, I was asked how I put the code so nicely formatted on my blog. Here are the steps:
  • Write the code in vs.net
  • Paste it into a new word document
  • Save the document as an html(filtered) (or .Text will have trouble with it)
  • Close the doc , then re-open it without changing any text after that (this is an important step)
  • Copy the code from the doc into your blog post
 
Update: ok. This was just too obvious. I've created a short word macro that does this for you.
simply paste the following code in a new macro module in word that belongs to the Normal.dot template.
Then assign it a keyboard shortcut using right click on toolbars-customize-keyboard-macros and you're done:
 

Sub FormatCodeForBlog()

    Selection.PasteAndFormat(wdPasteDefault)

    ActiveDocument.SaveAs(FileName:="temp.htm", FileFormat:=wdFormatFilteredHTML, _

          LockComments:=False, Password:="", AddToRecentFiles:=True, WritePassword _

        :="", ReadOnlyRecommended:=False, EmbedTrueTypeFonts:=False, _

        SaveNativePictureFormat:=False, SaveFormsData:=False, SaveAsAOCELetter:= _

        False)

    ActiveWindow.View.Type = wdWebView

    ActiveWindow.Close()

    RecentFiles(1).Open()

    Selection.WholeStory()

    Selection.Copy()

End Sub

Read: Pasting nicely formatted code into your blog

Topic: Dispose and close or close without dispose Previous Topic   Next Topic Topic: RSS Aggregators, Contd.

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use