From 3130020e20e3faaa1cacb4b83dcaf56d2cc99e1b Mon Sep 17 00:00:00 2001 From: jhoneill Date: Mon, 16 Mar 2020 11:10:44 +0000 Subject: [PATCH] apply freeze to 2 rows if title present #795 --- Public/Export-Excel.ps1 | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/Public/Export-Excel.ps1 b/Public/Export-Excel.ps1 index 5900aac..168e3a2 100644 --- a/Public/Export-Excel.ps1 +++ b/Public/Export-Excel.ps1 @@ -477,12 +477,24 @@ try { #Allow single switch or two seperate ones. if ($FreezeTopRowFirstColumn -or ($FreezeTopRow -and $FreezeFirstColumn)) { - $ws.View.FreezePanes(2, 2) - Write-Verbose -Message "Froze top row and first column" + if ($Title) { + $ws.View.FreezePanes(3, 2) + Write-Verbose -Message "Froze title and header rows and first column" + } + else { + $ws.View.FreezePanes(2, 2) + Write-Verbose -Message "Froze top row and first column" + } } elseif ($FreezeTopRow) { - $ws.View.FreezePanes(2, 1) - Write-Verbose -Message "Froze top row" + if ($Title) { + $ws.View.FreezePanes(2, 1) + Write-Verbose -Message "Froze title and header rows" + } + else { + $ws.View.FreezePanes(2, 1) + Write-Verbose -Message "Froze top row" + } } elseif ($FreezeFirstColumn) { $ws.View.FreezePanes(1, 2)