Skip to content

Commit

Permalink
apply freeze to 2 rows if title present dfinke#795
Browse files Browse the repository at this point in the history
  • Loading branch information
jhoneill committed Mar 16, 2020
1 parent fe68ddb commit 3130020
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions Public/Export-Excel.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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)

This comment has been minimized.

Copy link
@roberthuard

roberthuard Jan 6, 2023

Hi, both conditions are identical with (2, 1). I think (3, 1) should be use here.

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)
Expand Down

0 comments on commit 3130020

Please sign in to comment.