diff --git a/Export-Excel.ps1 b/Export-Excel.ps1 index ac1cd67..a9032c4 100644 --- a/Export-Excel.ps1 +++ b/Export-Excel.ps1 @@ -464,6 +464,7 @@ ) Begin { + $numberRegex = [Regex]'\d' function Add-CellValue { <# .SYNOPSIS @@ -530,7 +531,7 @@ Default { #Save a value as a number if possible $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 $TargetCell.Value = $number if ($setNumformat) {$targetCell.Style.Numberformat.Format = $Numberformat } diff --git a/README.md b/README.md index e68d190..c7f09af 100644 --- a/README.md +++ b/README.md @@ -51,7 +51,8 @@ Install-Module ImportExcel -scope CurrentUser ```PowerShell 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 -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.