修改HTML或Word的Powershell脚本输出?

时间:2014-02-11 03:43:03

标签: html powershell ms-word

我从另一个问题'借用'了这个代码;但是想知道以下任何一种情况是否可能

1 - 在生成的网页中有三列

2 - 在表格中导出到Word,三列宽

import-module activedirectory

$d = Get-Date -Format dd.MMM.yyyy

$a = "<style>"
$a = $a + "BODY{background-color:white;}"
$a = $a + "TABLE{border-width: 1px;border-style: solid;border-color: black}"
$a = $a + "TH{border-width: 1px;border-style: solid;border-color: black;background-color:grey}"
$a = $a + "TD{border-width: 1px;border-style: solid;border-color: black;background-color:white}"
$a = $a + "</style>"
$a = $a + "<img src=C:\Temp\test.jpg height='100' width='380'></img><br>"

$Pre = "<font size=6>Phone Directory - $d</font size>"
$Post = "<font size=2>Uncontrolled when Printed</font size>"

Get-ADUser -filter "OfficePhone -like '*'" -SearchBase 'OU=Staff, DC=test, DC=net' -Properties sn, GivenName, OfficePhone |
    Select-Object sn, GivenName, OfficePhone |
    Sort-Object sn |
    ConvertTo-Html -head $a -pre $Pre -Post $Post|
    Out-File c:\temp\dir.html

invoke-expression c:\temp\dir.html

0 个答案:

没有答案