wjj_123 你好,
不知道楼主的 Sheet 中列数,所以已七列为例,展示该功能,列数如果不同,更改判断逻辑即可:
后台代码:
- protected void Page_Load(object sender, EventArgs e)
- {
- if (!IsPostBack)
- {
- this.FpSpread1.Sheets[0].RowCount = 10;
- this.FpSpread1.Sheets[0].ColumnCount = 7;
- }
- }
复制代码 前台代码:
- <script type="text/javascript">
- window.onload = function () {
- var spread = this.document.getElementById("FpSpread1");
- spread.onkeydown = test;
- }
- function test() {
- if (event.keyCode == 13) {
- var spread = this.document.getElementById("FpSpread1");
- var activecol = spread.ActiveCol;
- var activerow = spread.ActiveRow;
- if (activecol==6) {
- spread.SetActiveCell(activerow + 1, 0);
- }
- else {
- spread.SetActiveCell(activerow , activecol + 2);
- }
- }
- }
- </script>
复制代码 |