PowerShell Display Table In HTML Email

后端 未结 7 2324
春和景丽
春和景丽 2021-01-02 12:17

Ok, this may have been answered, but I\'m new and trying to learn, so I guess I\'m not \"getting\" it. I have a variable that contains a table of information (I got it from

7条回答
  •  生来不讨喜
    2021-01-02 12:28

    To build on user1491315 answer.

    $html = ""
    $tableCol = $table.Columns | select Caption
    foreach($col in $tableCol){
        $html += ""
    }
        $html += ""
    $tableColCount = $table.Columns.Count
    foreach ($row in $table.Rows)
    {
        $html += ""
        For ($i=0; $i -le $tableColCount; $i++) {
            $html += ""
        }
        $html += ""
    }
    $html += "
    " + $col.Caption + "
    " + $row[$i] + "
    "

    This does the same thing but will automatically set column names.

提交回复
热议问题