HTML生成类

  1using System;
  2using System.Collections.Generic;
  3using System.Text;
  4using System.IO;
  5using System.Web;
  6/// <summary>
  7/// ====================
  8/// 作者:skyblue 带模板的HTML生成类 http://skyblue.cnblogs.com
  9/// 日期:2008-09-17
 10/// 版本:1.0.0
 11/// ====================
 12/// </summary>

 13namespace SkyBlue_HtmlMade
 14{
 15    /// <summary>
 16    /// HTML生成类
 17    /// </summary>

 18    public class MadeHtml
 19    {
 20        Members 成员
 88
 89        Contructors 构造
126
127        Methods 方法
250    }

251}

252

 

模版

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
    <title>生成试测</title>
    <style type="text/css">
    body
    {
    margin:0;
    padding:0;
    }
    .ContentDiv
    {
        float:left;
        border-top:solid 1px #000000;text-align:center;
        border-right:solid 1px #000000; width:98px;
    }
    </style>
</head>
<body>
<table align="center" border="0" cellpadding="0" cellspacing="0" width="400">
<tr>
<td style="border-left:solid 1px #000000; "><div class="ContentDiv">一</div><div class="ContentDiv">一</div><div class="ContentDiv">一</div><div class="ContentDiv">一</div><div class="ContentDiv">一</div><div class="ContentDiv">一</div>
<div class="ContentDiv">一</div>
<div class="ContentDiv">一</div>
<div class="ContentDiv">一</div>
<div class="ContentDiv">一</div>
<div class="ContentDiv">一</div>
<div class="ContentDiv">一</div>
<div class="ContentDiv">一</div>
<div class="ContentDiv">一</div>
<div style=" background-color:#000000;margin:0; padding:0; height:1px; width:99%"></div>

</td>
</tr>
</table>

</body>

</html>

 测式调用

       //<div class="ContentDiv">一</div>
        SkyBlue_HtmlMade.MadeHtml dal = new MadeHtml("Html/Template.htm", "html", "test.htm");
        string[] param ={ "$HtmlStr$" };
        string[] value ={ "<div class=""ContentDiv"">一</div><div class=""ContentDiv"">一</div><div class=""ContentDiv"">一</div><div class=""ContentDiv"">一</div><div class=""ContentDiv"">一</div><div class=""ContentDiv"">一</div>" };
        string flag= dal.HtmlWriting(param, value);
        Response.Write(flag);

 

 

posted @ 2008-09-17 11:55  天纯蓝  阅读(338)  评论(1编辑  收藏  举报