Better handling of Empry values when setting Columns/Rows

This commit is contained in:
jhoneill
2018-11-27 11:03:06 +00:00
parent 3afe2059e5
commit 2753a6876a
2 changed files with 10 additions and 8 deletions

View File

@@ -147,7 +147,8 @@
if ($Value -is [scriptblock] ) {
#re-create the script block otherwise variables from this function are out of scope.
$cellData = & ([scriptblock]::create( $Value ))
Write-Verbose -Message $cellData
if ($null -eq $cellData) {Write-Verbose -Message "Script block evaluates to null."}
else {Write-Verbose -Message "Script block evaluates to '$cellData'"}
}
else{$cellData = $Value}
if ($cellData -match "^=") { $Worksheet.Cells[$Row, $column].Formula = ($cellData -replace '^=','') } #EPPlus likes formulas with no = sign; Excel doesn't care