diff --git a/SetFormat.ps1 b/SetFormat.ps1 index d4a1928..12b6962 100644 --- a/SetFormat.ps1 +++ b/SetFormat.ps1 @@ -92,27 +92,31 @@ } else { if ($ResetFont) { - $Address.Style.Font.Color.SetColor("Black") - $Address.Style.Font.Bold = $false - $Address.Style.Font.Italic = $false - $Address.Style.Font.UnderLine = $false - $Address.Style.Font.Strike = $false + $Address.Style.Font.Color.SetColor("Black") + $Address.Style.Font.Bold = $false + $Address.Style.Font.Italic = $false + $Address.Style.Font.UnderLine = $false + $Address.Style.Font.Strike = $false } - if ($Underline) { - $Address.Style.Font.UnderLine = $true - $Address.Style.Font.UnderLineType = $UnderLineType + if ($Underline) { + $Address.Style.Font.UnderLine = $true + $Address.Style.Font.UnderLineType = $UnderLineType } - if ($Bold) {$Address.Style.Font.Bold = $true } - if ($Italic) {$Address.Style.Font.Italic = $true } - if ($StrikeThru) {$Address.Style.Font.Strike = $true } - if ($FontShift) {$Address.Style.Font.VerticalAlign = $FontShift } - if ($FontColor) {$Address.Style.Font.Color.SetColor( $FontColor ) } - - if ($BorderAround) { - $Address.Style.Border.BorderAround($BorderAround, $BorderColor) - } + if ($Bold) {$Address.Style.Font.Bold = $true } + if ($Italic) {$Address.Style.Font.Italic = $true } + if ($StrikeThru) {$Address.Style.Font.Strike = $true } + if ($FontShift) {$Address.Style.Font.VerticalAlign = $FontShift } + if ($FontColor) {$Address.Style.Font.Color.SetColor( $FontColor ) } + if ($NumberFormat) {$Address.Style.Numberformat.Format = $NumberFormat } + if ($TextRotation) {$Address.Style.TextRotation = $TextRotation } + if ($WrapText) {$Address.Style.WrapText = $true } + if ($HorizontalAlignment) {$Address.Style.HorizontalAlignment = $HorizontalAlignment } + if ($VerticalAlignment) {$Address.Style.VerticalAlignment = $VerticalAlignment } + if ($Value) {$Address.Value = $Value } + if ($Formula) {$Address.Formula = $Formula } + if ($BorderAround) {$Address.Style.Border.BorderAround($BorderAround, $BorderColor)} - if ($BorderBottom) { + if ($BorderBottom) { $Address.Style.Border.Bottom.Style=$BorderBottom $Address.Style.Border.Bottom.Color.SetColor($BorderColor) } @@ -132,12 +136,6 @@ $Address.Style.Border.Right.Color.SetColor($BorderColor) } - if ($NumberFormat) {$Address.Style.Numberformat.Format = $NumberFormat } - if ($TextRotation) {$Address.Style.TextRotation = $TextRotation } - if ($WrapText) {$Address.Style.WrapText = $true } - if ($HorizontalAlignment) {$Address.Style.HorizontalAlignment = $HorizontalAlignment } - if ($VerticalAlignment) {$Address.Style.VerticalAlignment = $VerticalAlignment } - if ($BackgroundColor) { $Address.Style.Fill.PatternType = $BackgroundPattern $Address.Style.Fill.BackgroundColor.SetColor($BackgroundColor) @@ -179,13 +177,6 @@ else {Write-Warning -Message ("Can hide a row or a column but not a {0} object" -f ($Address.GetType().name)) } } - if ($Value) { - $Address.Value = $Value - } - - if ($Formula) { - $Address.Formula = $Formula - } } } } \ No newline at end of file