From 87590706367b22d23ea757b4dd087a4e0f0113dd Mon Sep 17 00:00:00 2001 From: jhoneill Date: Wed, 24 Jul 2019 12:01:06 +0100 Subject: [PATCH] add clearall to set-ExcelRange; --- Set-Row.ps1 | 2 +- SetFormat.ps1 | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Set-Row.ps1 b/Set-Row.ps1 index 4984237..0b3115b 100644 --- a/Set-Row.ps1 +++ b/Set-Row.ps1 @@ -13,7 +13,7 @@ Set-ExcelRow -Worksheet $ws -Heading Total -Value {"=sum($columnName`2:$columnName$endrow)" } $Ws contains a worksheet object, and no Row number is specified so - Set-ExcelRow will select the next row after the endof the data in + Set-ExcelRow will select the next row after the end of the data in the sheet. The first cell in the row will contain "Total", and each of the other cells will contain =Sum(xx2:xx99) diff --git a/SetFormat.ps1 b/SetFormat.ps1 index 6c73d79..07dd5e0 100644 --- a/SetFormat.ps1 +++ b/SetFormat.ps1 @@ -124,7 +124,10 @@ $Range = $WorkSheet.Cells[$Range] } elseif ($Range -is [string]) {Write-Warning -Message "The range pararameter you have specified also needs a worksheet parameter." ;return} - #else we assume Range is a range. + #else we assume $Range is a range. + if ($ClearAll) { + $Range.Clear() + } if ($ResetFont) { $Range.Style.Font.Color.SetColor( ([System.Drawing.Color]::Black)) $Range.Style.Font.Bold = $false @@ -332,6 +335,7 @@ if (Get-Command -ErrorAction SilentlyContinue -name Register-ArgumentCompleter) Register-ArgumentCompleter -CommandName Set-ExcelRange -ParameterName FontName -ScriptBlock $Function:ListFonts Register-ArgumentCompleter -CommandName Set-ExcelRow -ParameterName FontName -ScriptBlock $Function:ListFonts } + function Expand-NumberFormat { <# .SYNOPSIS