freeze top row using spreadsheetgear

China☆狼群 提交于 2019-12-10 17:34:37

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!