the steps to use the code highlighting plug-in are as follows:
Step one: Download the plugin and source code: Syntaxhighlighter4word.zip
Step two: After downloading the file, decompression, Then double-click Binword2010Kong.SyntaxHighlighter.Word2010.vsto or Binword2007Kong.SyntaxHighlighter.Word2007.vsto to complete the installation, assuming that you installed. Net Framework 4.0. After the installation is successful, the following prompts:
Step three: After installing the plug-in, you will have one more ribbon in Word (support word2007 and word2010):
Step four: Click the "Settings" button, pop-up settings interface:
Step five: This simplifies the configuration and removes some of the settings from the previous version.
Step Six: Click the "Insert Code" button to eject the following interface:
Step Seven: You can choose from C #, Java, Xml, JavaScript, and many other languages.
Step eight: In Word the effect is as follows:
Step nine: After posting to the blog, the effect is as follows:
Using System;
Using System.Collections.Generic;
Using System.Linq;
Using System.Text;
Using System.Windows.Forms;
Using Kong.SyntaxHighlighter.Winform;
Using Microsoft.Office.Tools.Ribbon;
Namespace Kong.SyntaxHighlighter.Word
{
public partial class Ribbon1
{
private void Ribbon1_load (object sender, Ribbonuieventargs e)
{
}
}
}
Step Ten: I generated this code in Word, using OL and Li, and set the ol and Li's style, so that in Word can display borders and alternating lines of color, at the same time for OL set a class=codeblock, After posting to the blog, you can use this style name Codeblock to customize your favorite style. The code I generate in Word is probably like this:
Step 11: So we are in the blog, not set all ol style, fortunately, blog Park articles are in an ID for the cnblogs_post_body under the Div, So I added the following style to my blog:
#cnblogs_post_body ol
{
border:1px dotted #000066;
line-height:150%;
Word-break:break-word;
Font-family:consolas, Verdana!important;
border-radius:5px;
width:90%;
Background-color: #E3E3FF;
List-style-position:outside;
margin-left:0px;
}
#cnblogs_post_body ol font
{
font-size:12px!important
}
#cnblogs_post_body ol li
{
Background-color: #fff;
padding-left:5px;
Border-left:1px solid #8A8AFF;
margin-left:5px!important;
}
#cnblogs_post_body ol li:nth-child (even)
{
Background-color: #f5f5f5;
}
Step 12: To add, this text is added here: