Refined fix for #419

This commit is contained in:
jhoneill
2018-08-14 12:54:17 +01:00
parent 07342235b9
commit f768634214
2 changed files with 4 additions and 2 deletions

View File

@@ -464,6 +464,7 @@
) )
Begin { Begin {
$numberRegex = [Regex]'\d'
function Add-CellValue { function Add-CellValue {
<# <#
.SYNOPSIS .SYNOPSIS
@@ -530,7 +531,7 @@
Default { Default {
#Save a value as a number if possible #Save a value as a number if possible
$number = $null $number = $null
if (($_ -match '[0-9]')-and [Double]::TryParse($_, [System.Globalization.NumberStyles]::Any, [System.Globalization.NumberFormatInfo]::CurrentInfo, [Ref]$number)) { if ($numberRegex.IsMatch($_) -and [Double]::TryParse($_, [System.Globalization.NumberStyles]::Any, [System.Globalization.NumberFormatInfo]::CurrentInfo, [Ref]$number)) {
# as simpler version using [Double]::TryParse( $_ , [ref]$number)) was found to cause problems reverted back to the longer version # as simpler version using [Double]::TryParse( $_ , [ref]$number)) was found to cause problems reverted back to the longer version
$TargetCell.Value = $number $TargetCell.Value = $number
if ($setNumformat) {$targetCell.Style.Numberformat.Format = $Numberformat } if ($setNumformat) {$targetCell.Style.Numberformat.Format = $Numberformat }

View File

@@ -51,7 +51,8 @@ Install-Module ImportExcel -scope CurrentUser
```PowerShell ```PowerShell
Install-Module ImportExcel Install-Module ImportExcel
``` ```
# New to Aug 13th # New to Aug 14th
- In Export-Excel improved the catch-all handler for insering values to cope better with nested objects and reduce the number of parse operations
- Added -Calculate switch to Export-Excel and Close-Excel Package; EPPlus needs formulas to OMIT the leading = sign so where formula is set it now strips a leading = - Added -Calculate switch to Export-Excel and Close-Excel Package; EPPlus needs formulas to OMIT the leading = sign so where formula is set it now strips a leading =
- Added -PivotTotals parameter where there was already -NoTotalsInPivot new one allows None, Both, Rows, Columns. (#415) - Added -PivotTotals parameter where there was already -NoTotalsInPivot new one allows None, Both, Rows, Columns. (#415)
- When appending Export-Excel only extended tables and ranges if they were explicitly specified. It now does it automatically. - When appending Export-Excel only extended tables and ranges if they were explicitly specified. It now does it automatically.