2011-11-16 20 views
1

我卡在这,我只是做了一个小的部署工具,它的工作原理是这样的:生成经过一系列步骤的HTML报告在C#中做

  • 抓斗的MSI安装程序并进行安装
  • 复制所有的配置文件进行修改后
  • 一旦所有的文件被修改的部署工具再次跑了,它会将所有的文件,并重新启动IIS服务器,如果必要

上周五我呈丁老说我应该产生表明每一步成功完成一个HTML报告,我手工制作的HTML文件是这样的:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 
    <html> 
    <head> 
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 
    <title>Project Deployment Report</title> 
    <link href="css/main.css" rel="stylesheet" type="text/css"> 
    </head> 
    <div id="main"> 

    <h1>Project Deployment Report - {DATE}</h1> 
    <br /> 
    <h2>First Run</h2> 
    <p>This will report when the Project Deployment tool is run with "-f" parameter, this will copy all 
    the configuration files to be modified afterwards</p> 

    <table class ="one-column-emphasis"> 
    <colgroup> 
     <col class="oce-first"> 
    </colgroup> 
    <thead> 
     <tr> 
      <th scope="col">Project Name</th> 
      <th scope="col">Install for the first time</th> 
      <th scope="col">Copy Original Config files</th> 
     </tr> 
    </thead> 
    <tbody> 
     <tr> 
      <td>{PROJECT NAME}</td> 
      <td>{POSSIBLE OUTCOME}</td> 
      <td>{POSSIBLE OUTCOME}</td> 
     </tr> 
     <tr> 
      <td>{PROJECT NAME}</td> 
      <td>{POSSIBLE OUTCOME}</td> 
      <td>{POSSIBLE OUTCOME}</td> 
     </tr> 
     <tr> 
      <td>{PROJECT NAME}</td> 
      <td>{POSSIBLE OUTCOME}</td> 
      <td>{POSSIBLE OUTCOME}</td> 
     </tr> 
    </tbody> 
    </table> 

    <br /> 
    <h2>Copy Configuration Run</h2> 
    <p></p> 

    <table class ="one-column-emphasis"> 
    <colgroup> 
     <col class="oce-first"> 
    </colgroup> 
    <thead> 
     <tr> 
      <th scope="col">Project Name</th> 
      <th scope="col">Install for the first time</th> 
      <th scope="col">Copy Original Config files</th> 
     </tr> 
    </thead> 
    <tbody> 
     <tr> 
      <td>Lookup Service</td> 
      <td>Correct</td> 
      <td>Correct</td> 
     </tr> 
     <tr> 
      <td>{PROJECT NAME}</td> 
      <td>{POSSIBLE OUTCOME}</td> 
      <td>{POSSIBLE OUTCOME}</td> 
     </tr> 
     <tr> 
      <td>{PROJECT NAME}</td> 
      <td>{POSSIBLE OUTCOME}</td> 
      <td>{POSSIBLE OUTCOME}</td> 
     </tr> 
    </tbody> 
    </table> 

    </div> 
    <body> 
    </body> 
    </html> 

我得到了一个单记录,在同一时间作为一个主题,并有两个订户a ConsoleLoggerHtmlLogger

我的问题和我的问题是如何解释日志时,信息被“推”到Html记录器,一旦有如何填写HTML报告。

我的想法是创建一个具有项目名称列表的类或结构,它们可能会产生结果,但我看不到如何填写我拥有的html报告。

对此的任何意见或建议?

谢谢,问候!

回答

1

我最喜欢的生成html报告方式是实际填充XML文档,然后通过XSL将生成的XML转换为HTML。

它更容易填写,它也更容易改变输出格式。

+0

你有链接到教程或例子吗?谢谢乔恩! – hyeomans

+0

此代码项目演练有一个相当简单的样式表,可以作为基础。 http://www.codeproject.com/KB/XML/XML_to_HTML_Convertor.aspx –