使用列标题和行标题创建HTML表

时间:2016-11-03 10:37:57

标签: html powershell

我已使用下面的HTML代码段成功编写了PS报告脚本,将结果创建到表中:

 $tableHeader = " 
 <table width='auto'><tbody> 
 <td width='auto' bgcolor=`'$blue'' align='center'>Server</td>
 <td width='auto' bgcolor=`'$blue'' align='center'>CPU</td>
 <td width='auto' bgcolor=`'$purple'' align='center'>RAM</td> 
 <td width='auto' bgcolor=`'$yellow'' align='center'>Disk</td>
 </tr>
" 
Add-Content $ReportPath $tableHeader

然后在将结果添加到上一个表之前,将一些脚本返回到变量中。

 $DataRow = " 
      <tr> 
      <td width='auto' align='center'>$Computer</td>     
      <td width='auto' align='center'>$CPUValue</td>          
      <td width='auto' align='center'>$RAMValue</td>
      <td width='auto' align='center'>$DiskValue</td> 
      </tr> 
    "
    Add-Content $ReportPath $DataRow;

这非常有效,顶行的列和下面的结果。但现在我正在寻找在表格左侧添加一个额外的列,让我们说我们有&#34; Computer1&#34 ;; &#34;计算机2&#34;等等。

0 个答案:

没有答案