mirror of
https://github.com/dfinke/ImportExcel.git
synced 2025-12-06 00:23:20 +00:00
Fixes around EPPlus update
This commit is contained in:
BIN
EPPlus.dll
BIN
EPPlus.dll
Binary file not shown.
@@ -272,8 +272,11 @@
|
||||
Write-Warning -Message "PivotTable defined in $($pivotTableName) already exists, only the data range will be changed."
|
||||
$pivotTable = $wsPivot.PivotTables[$pivotTableName]
|
||||
if (-not $SourceRange) { $SourceRange = $SourceWorkSheet.Dimension.Address}
|
||||
$pivotTable.CacheDefinition.CacheDefinitionXml.pivotCacheDefinition.cacheSource.worksheetSource.ref = $SourceRange
|
||||
}
|
||||
$pivotTable.CacheDefinition.SourceRange = $SourceWorkSheet.cells[$SourceRange]
|
||||
#change for epPlus 4.5 - Previously needed to hack the xml
|
||||
# $pivotTable.CacheDefinition.CacheDefinitionXml.pivotCacheDefinition.cacheSource.worksheetSource.ref = $SourceRange
|
||||
|
||||
}
|
||||
|
||||
#Create the chart if it doesn't exist, leave alone if it does.
|
||||
if ($IncludePivotChart -and -not $wsPivot.Drawings["Chart$pivotTableName"] ) {
|
||||
|
||||
@@ -461,11 +461,13 @@ Describe ExportExcel {
|
||||
$excel.ProcessesPivotTable | Should not beNullOrEmpty
|
||||
$PTws | Should not beNullOrEmpty
|
||||
$PTws.PivotTables.Count | Should be 1
|
||||
$PTws.View.TabSelected | Should be $true
|
||||
$Excel.Workbook.Worksheets["Processes"] | Should not beNullOrEmpty
|
||||
$Excel.Workbook.Worksheets.Count | Should beGreaterThan 2
|
||||
$excel.Workbook.Worksheets["Processes"].Dimension.rows | Should be 21 #20 data + 1 header
|
||||
}
|
||||
it "Selected the Pivottable page " {
|
||||
$PTws.View.TabSelected | Should be $true
|
||||
} -Skip # << Bug in EPPLus 4.5
|
||||
$pt = $PTws.PivotTables[0]
|
||||
it "Built the expected Pivot table " {
|
||||
$pt.RowFields.Count | Should be 1
|
||||
@@ -477,8 +479,6 @@ Describe ExportExcel {
|
||||
}
|
||||
#test adding pivot chart using the already open sheet
|
||||
$warnvar = $null
|
||||
Export-Excel -ExcelPackage $Excel -WorkSheetname Processes -IncludePivotTable -PivotRows Company -PivotData PM -IncludePivotChart -ChartType PieExploded3D -ShowCategory -ShowPercent -NoLegend -WarningAction SilentlyContinue -WarningVariable warnvar
|
||||
$Excel = Open-ExcelPackage $path
|
||||
it "Added a chart to the pivot table without rebuilding " {
|
||||
$ws = $Excel.Workbook.Worksheets["ProcessesPivotTable"]
|
||||
$Excel.Workbook.Worksheets.Count | Should be $wCount
|
||||
@@ -678,10 +678,10 @@ Describe ExportExcel {
|
||||
$PC1 = $ptsheet1.Drawings[0]
|
||||
$PC2 = $ptsheet2.Drawings[0]
|
||||
it "Created the pivot tables linked to the right data. " {
|
||||
$PT1.CacheDefinition.CacheDefinitionXml.pivotCacheDefinition.cacheSource.worksheetSource.ref |
|
||||
Should be ("A1:" + $ws1.Dimension.End.Address)
|
||||
$PT2.CacheDefinition.CacheDefinitionXml.pivotCacheDefinition.cacheSource.worksheetSource.ref |
|
||||
Should be ("A2:" + $ws2.Dimension.End.Address) #Title in row 1
|
||||
$PT1.CacheDefinition.CacheDefinitionXml.pivotCacheDefinition.cacheSource.worksheetSource.name|
|
||||
Should be "All_services"
|
||||
$PT2.CacheDefinition.CacheDefinitionXml.pivotCacheDefinition.cacheSource.worksheetSource.name |
|
||||
Should be "Processes"
|
||||
}
|
||||
it "Set the other pivot tables and chart options from the definitions. " {
|
||||
$pt1.PageFields[0].Name | Should be 'StartType'
|
||||
|
||||
@@ -40,7 +40,7 @@ Describe "Creating workbook with a single line" {
|
||||
}
|
||||
}
|
||||
Context "PivotTable" {
|
||||
it "Created the PivotTable on a new page and made it active " {
|
||||
it "Created the PivotTable on a new page " {
|
||||
$ws2 | Should not beNullOrEmpty
|
||||
$ws2.PivotTables[0] | Should not beNullOrEmpty
|
||||
$ws2.PivotTables[0].Fields.Count | Should be 4
|
||||
@@ -49,8 +49,10 @@ Describe "Creating workbook with a single line" {
|
||||
$ws2.PivotTables[0].ColumnFields[0].Name | Should be "Product"
|
||||
$ws2.PivotTables[0].RowGrandTotals | Should be $true
|
||||
$ws2.PivotTables[0].ColumGrandTotals | Should be $true #Epplus's mis-spelling of column not mine
|
||||
$ws2.View.TabSelected | Should be $true
|
||||
}
|
||||
it "Made the PivotTable page active " {
|
||||
$ws2.View.TabSelected | Should be $true
|
||||
} -Skip # << Bug in EPPLus 4.5
|
||||
it "Created the Pivot Chart " {
|
||||
$ws2.Drawings[0] | Should not beNullOrEmpty
|
||||
$ws2.Drawings[0].ChartType.ToString() | Should be ColumnClustered
|
||||
|
||||
@@ -81,7 +81,7 @@ Describe "Creating small named ranges with hyperlinks" {
|
||||
$placesMade = $Sheet.Cells[(2 + $results.Count), 5].value - $Sheet.Cells[(2 + $results.Count), 3].value
|
||||
$sheet.Cells[(2 + $results.Count), $columns].value | Should be $placesmade
|
||||
}
|
||||
It "Applied ConditionalFormatting, including StopIfTrue, Priority and Reverse " {
|
||||
It "Applied ConditionalFormatting, including StopIfTrue, Priority " {
|
||||
$sheet.ConditionalFormatting[0].Address.Start.Column | should be $columns
|
||||
$sheet.ConditionalFormatting[0].Address.End.Column | should be $columns
|
||||
$sheet.ConditionalFormatting[0].Address.End.Row | should be $expectedRows
|
||||
@@ -90,11 +90,13 @@ Describe "Creating small named ranges with hyperlinks" {
|
||||
$sheet.ConditionalFormatting[0].Icon3.Value | Should be 1
|
||||
$sheet.ConditionalFormatting[1].Priority | Should be 1
|
||||
$sheet.ConditionalFormatting[1].StopIfTrue | Should be $true
|
||||
}
|
||||
It "Applied ConditionalFormatting, including Reverse " {
|
||||
$sheet.ConditionalFormatting[3].LowValue.Color.R | Should begreaterThan 180
|
||||
$sheet.ConditionalFormatting[3].LowValue.Color.G | Should beLessThan 128
|
||||
$sheet.ConditionalFormatting[3].HighValue.Color.R | Should beLessThan 128
|
||||
$sheet.ConditionalFormatting[3].HighValue.Color.G | Should begreaterThan 180
|
||||
}
|
||||
} -Skip # << Bug in EPPLus 4.5
|
||||
}
|
||||
Context "Adding a table" {
|
||||
it "Created a table " {
|
||||
|
||||
@@ -52,7 +52,7 @@ Describe "Join Worksheet part 1" {
|
||||
it "Activated the correct worksheet " {
|
||||
$excel.Workbook.worksheets["SummaryPivot"].View.TabSelected | Should be $true
|
||||
$excel.Workbook.worksheets["Total"].View.TabSelected | Should be $false
|
||||
}
|
||||
} -Skip # << Bug in EPPLus 4.5
|
||||
|
||||
}
|
||||
Context "Merging 3 blocks" {
|
||||
|
||||
@@ -22,15 +22,15 @@ Describe "Setting worksheet protection " {
|
||||
$excel = Open-ExcelPackage -Path $path
|
||||
$ws = $ws = $excel.sheet1
|
||||
}
|
||||
it "Turned on protection for the sheet " {
|
||||
it "Turned on protection for the sheet " {
|
||||
$ws.Protection.IsProtected | should be $true
|
||||
}
|
||||
it "Set sheet-wide protection options " {
|
||||
it "Set sheet-wide protection options " {
|
||||
$ws.Protection.AllowEditObject | should be $false
|
||||
$ws.Protection.AllowFormatRows | should be $true
|
||||
$ws.cells["a2"].Style.Locked | should be $true
|
||||
}
|
||||
it "Unprotected some cells " {
|
||||
it "Unprotected some cells " {
|
||||
$ws.cells["a1"].Style.Locked | should be $false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,7 +32,6 @@ Describe "Data validation and protection" {
|
||||
$ws.DataValidations[0].ValidationType.Type.tostring() | Should be 'List'
|
||||
$ws.DataValidations[0].Formula.ExcelFormula | Should be 'values!$a$1:$a$10'
|
||||
$ws.DataValidations[0].Formula2 | Should benullorempty
|
||||
$ws.DataValidations[0].Operator.tostring() | should be 'any'
|
||||
}
|
||||
It "Created an integer validation rule for values between X and Y " {
|
||||
$ws.DataValidations[1].ValidationType.Type.tostring() | Should be 'Whole'
|
||||
|
||||
Reference in New Issue
Block a user