1.上SyntaxHighlighter官网下载引用文件,并上传到博客园 http://alexgorbatchev.com/SyntaxHighlighter/download/
2.文件,上传
3.记录一些两个文件的url地址
4.设置,在页首HTML代码中添加上面两个地址的引用,具体的看图
5.编辑器正常使用,如果想使用 syntaxhighlighter插件 ,就:选择编辑html代码=>添加<pre></pre>标签对,<pre>添加属性:'class="brush: 引用代码使用的语言(具体例子看下图)
6.具体案例:
eg:<pre class="brush: js;">
1
2
3
4
|
function
helloSyntaxHighlighter()
{
return
"hi!"
;
}
|
eg:<pre class="brush: c-sharp;">
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
[System.Diagnostics.CodeAnalysis.SuppressMessage(
"Microsoft.Security"
,
"CA2100:检查 SQL 查询是否存在安全漏洞"
)]
public
static
DataTable ExcelToDataTable(
string
strExcelFileName,
string
strSheetName)
{
string
strConn =
"Provider=Microsoft.Jet.OLEDB.4.0;"
+
"Data Source="
+ strExcelFileName +
";"
+
"Extended Properties=Excel 5.0;"
;
string
strExcel =
string
.Format(
"select * from [{0}$]"
, strSheetName);
DataSet ds =
new
DataSet();
using
(OleDbConnection conn =
new
OleDbConnection(strConn))
{
conn.Open();
OleDbDataAdapter adapter =
new
OleDbDataAdapter(strExcel, strConn);
adapter.Fill(ds, strSheetName);
conn.Close();
return
ds.Tables[strSheetName];
}
}
|
发完我才发现,,,博客园现在也已经内置了。。。。。看看吧,当涨个经验
博客园内置的编辑器:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
[System.Diagnostics.CodeAnalysis.SuppressMessage(
"Microsoft.Security"
,
"CA2100:检查 SQL 查询是否存在安全漏洞"
)]
public
static
DataTable ExcelToDataTable(
string
strExcelFileName,
string
strSheetName)
{
string
strConn =
"Provider=Microsoft.Jet.OLEDB.4.0;"
+
"Data Source="
+ strExcelFileName +
";"
+
"Extended Properties=Excel 5.0;"
;
string
strExcel =
string
.Format(
"select * from [{0}$]"
, strSheetName);
DataSet ds =
new
DataSet();
using
(OleDbConnection conn =
new
OleDbConnection(strConn))
{
conn.Open();
OleDbDataAdapter adapter =
new
OleDbDataAdapter(strExcel, strConn);
adapter.Fill(ds, strSheetName);
conn.Close();
return
ds.Tables[strSheetName];
}
}
|
本文转自毒逆天博客园博客,原文链接:http://www.cnblogs.com/dunitian/p/4828258.html,如需转载请自行联系原作者