您的位置:首页 > 编程语言 > ASP

asp.net 生成静态页 自动分页

2010-03-12 16:35 387 查看
/Files/oneroom/staticPage.rar代码

using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
ToHtml th = new ToHtml();
th.ReadTemplate("template.html", System.Text.Encoding.UTF8);
string content = "这是第一页[pagerTag]这是第二页[pagerTag]这是第三页[pagerTag]这是第四页";
string[] arr = System.Text.RegularExpressions.Regex.Split(content,@"\[pagerTag\]", System.Text.RegularExpressions.RegexOptions.IgnoreCase|System.Text.RegularExpressions.RegexOptions.Multiline);

int i = 0;
int len = arr.Length;
for (; i < len; ++i)
{
th.ReadTemplate("template.html", System.Text.Encoding.UTF8);
th.startPosition = "<!--content_begin-->";
th.endPosition = "<!--content_end-->";
th.Value = arr[i];
th.replaceTemplate();

th.Value = "替换字符串";
th.ReplaceText(@"\#list\#");

th.Value = th.GetHtmlPager(len, i + 1, "index_", ".html") ;

th.ReplaceText(@"\#pagerTag\#");

th.CreateHtml("./", "index_"+(i+1)+".html", System.Text.Encoding.UTF8);

}

}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: