Question

How can I freeze top row (and only the row) using spreadsheetgear?

when I try this:

worksheet.WindowInfo.FreezePanes = true;

It freezes both the top row and the first column (A). I only need it to freeze the top row.

Was it helpful?

Solution

After some research I found out I need to select the cell first and then set the FreezePanes property:

worksheet.Cells[1,0].Select();
worksheet.WindowInfo.FreezePanes = true;

Basically what happens is it freezes rows above and columns to the left of the selected cell.

OTHER TIPS

The above solution did not work for me. Here's what I did and succeeded:

worksheet.WindowInfo.ScrollColumn = 0;
worksheet.WindowInfo.SplitColumns = 0;
worksheet.WindowInfo.ScrollRow = 0;
worksheet.WindowInfo.SplitRows = 1;
worksheet.WindowInfo.FreezePanes = true;
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top