问题
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.
回答1:
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.
回答2:
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;
来源:https://stackoverflow.com/questions/16963370/freeze-top-row-using-spreadsheetgear