Fix -UnderLineType parameter is ignored in Set-ExcelColumn #1204

This commit is contained in:
dfinke
2022-07-04 10:29:39 -04:00
parent 115fbb23a7
commit f2544ed1ec
4 changed files with 66 additions and 11 deletions

View File

@@ -6,7 +6,7 @@
RootModule = 'ImportExcel.psm1'
# Version number of this module.
ModuleVersion = '7.6.0'
ModuleVersion = '7.7.0'
# ID used to uniquely identify this module
GUID = '60dd4136-feff-401a-ba27-a84458c57ede'

View File

@@ -110,7 +110,7 @@
#region Apply formatting
$params = @{}
foreach ($p in @('Underline','Bold','Italic','StrikeThru', 'FontName', 'FontSize','FontShift','NumberFormat','TextRotation',
foreach ($p in @('Underline','UnderLineType','Bold','Italic','StrikeThru', 'FontName', 'FontSize','FontShift','NumberFormat','TextRotation',
'WrapText', 'HorizontalAlignment','VerticalAlignment', 'Autosize', 'Width', 'FontColor'
'BorderAround', 'BackgroundColor', 'BackgroundPattern', 'PatternColor')) {
if ($PSBoundParameters.ContainsKey($p)) {$params[$p] = $PSBoundParameters[$p]}

View File

@@ -1081,4 +1081,55 @@ Describe ExportExcel -Tag "ExportExcel" {
}
}
}
Context " # Check UnderLineType" -Tag CheckUnderLineType {
BeforeAll {
$Path = Join-Path (Resolve-Path 'TestDrive:').ProviderPath "testUnderLineType.xlsx"
Remove-Item -Path $Path -ErrorAction SilentlyContinue
$data = "
Set-ExcelRange,Set-ExcelColumn
Should be double underlined,Should be double underlined
Should be double underlined,Should be double underlined
" | ConvertFrom-Csv
$data | Export-Excel $Path -AutoSize
$excel = Open-ExcelPackage $Path
$ws = $excel.Workbook.Worksheets["sheet1"]
Set-ExcelRange -Range $ws.Cells["A2:A3"] -Underline -UnderLineType "Double"
Set-ExcelColumn -Worksheet $ws -Column 2 -StartRow 2 -Underline -UnderLineType "Double"
Close-ExcelPackage $excel
}
AfterAll {
Remove-Item -Path $Path -ErrorAction SilentlyContinue
}
it "Check Cell Style Font via Set-ExcelColumn".PadRight(87) {
$excel = Open-ExcelPackage $Path
$cell = $excel.Sheet1.Cells["B2"]
$actual = $cell.Style.Font
$actual.Underline | Should -BeTrue
$actual.UnderlineType | Should -Be "Double"
Close-ExcelPackage $excel -NoSave
}
it "Check Cell Style Font via Set-ExcelRange".PadRight(87) {
$excel = Open-ExcelPackage $Path
$cell = $excel.Sheet1.Cells["A2"]
$actual = $cell.Style.Font
$actual.Underline | Should -BeTrue
$actual.UnderlineType | Should -Be "Double"
Close-ExcelPackage $excel -NoSave
}
}
}

View File

@@ -1,3 +1,7 @@
# 7.7.0
- Fix a bug with `-UnderLineType parameter is ignored in Set-ExcelColumn` [#1204](https://github.com/dfinke/ImportExcel/issues/1204)
# 7.6.0
- **_[Under investigation]_** Fix -StartRow and -StartColumn being ignored.