我使用腳本在 excel 中查找行并洗掉整行。現在我不想洗掉而是將字體更改為洗掉線。
部分代碼是:`
$Rows = get-content c:\temp\Rrows.txt
foreach($Row in $Rows){
if ($ExcelWorkSheet2.cells.Item($Row,3).Value() -ne "Something"){
#$ExcelWorkSheet2.Cells.Item($Row,1).style.Font.Strikethrough = $True
#$ExcelWorkSheet2.Cells.Item($Row,2).style.Font.Strikethrough = $True
#$ExcelWorkSheet2.Cells.Item($Row,3).style.Font.Strikethrough = $True
#$ExcelWorkSheet2.rows($Row).style.Font.Strikethrough = $True
$RowToDelete = $ExcelWorkSheet2.Cells.Item($Row,1).EntireRow
$RowToDelete.Delete()
}}
` 我嘗試了 2 種不同的方法,結果是洗掉了整個作業表,而不僅僅是指定的行。這里有什么問題?
uj5u.com熱心網友回復:
只需將線路更改$RowToDelete.Delete()為
$RowToDelete.Font.Strikethrough = $true
洗掉線是行的 Font 物件的屬性。只需將其設定為$true并保存更改
轉載請註明出處,本文鏈接:https://www.uj5u.com/qukuanlian/526128.html
標籤:擅长电源外壳字体
