• Pasting nicely formatted code into your blog from Visual Studio.NET


    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

    From: http://weblogs.asp.net/rosherove/archive/2004/02/05/67957.aspx

  • 相关阅读:
    tp框架实现ajax
    tp框架的增删改查
    tp框架获取常量信息、方法、命名空间
    tp框架,访问方式、空方法
    tp基础,文件存储路径
    缓存
    CMS系统存储路径
    Smarty模版引擎的原理
    php的empty(),trim(),strlen()方法
    PHP 流程管理
  • 原文地址:https://www.cnblogs.com/dudu/p/1318.html
Copyright © 2020-2023  润新知