找回密码
 立即注册

QQ登录

只需一步,快速开始

Barry
中级会员   /  发表于:2021-10-26 10:24  /   查看:2055  /  回复:9
1金币
{
    "cmd": "fill",
    "sheetName": "Sheet6",
    "startRange": {
        "row": 4,
        "rowCount": 1,
        "col": 10,
        "colCount": 1
    },
    "fillRange": {
        "row": 5,
        "rowCount": 3,
        "col": 10,
        "colCount": 1
    },
    "autoFillType": 0,
    "fillDirection": 3,
    "xC": {
        "GLc": [
            {
                "row": 4,
                "rowCount": 4,
                "col": 10,
                "colCount": 1
            }
        ],
        "HLc": {
            "row": 4,
            "col": 10
        }
    },
    "d_": {
        "kj": {
            "name": "Sheet6",
            "isSelected": true,
            "activeRow": 5,
            "activeCol": 10,
            "frozenTrailingRowStickToEdge": true,
            "frozenTrailingColumnStickToEdge": true,
            "theme": "Office",
            "data": {
                "dataTable": {
                    "0": {
                        "0": {
                            "style": {
                                "hAlign": 1
                            }
                        },
                        "5": {
                            "value": 22
                        }
                    },
                    "2": {
                        "3": {
                            "value": 23
                        }
                    },
                    "4": {
                        "8": {
                            "value": 232
                        },
                        "10": {
                            "value": 232
                        }
                    },
                    "5": {
                        "10": {
                            "value": 232,
                            "style": {
                                "hAlign": 3,
                                "vAlign": 0,
                                "themeFont": "Body",
                                "imeMode": 1
                            }
                        }
                    },
                    "6": {
                        "10": {
                            "value": 232,
                            "style": {
                                "hAlign": 3,
                                "vAlign": 0,
                                "themeFont": "Body",
                                "imeMode": 1
                            }
                        }
                    },
                    "7": {
                        "10": {
                            "value": 232,
                            "style": {
                                "hAlign": 3,
                                "vAlign": 0,
                                "themeFont": "Body",
                                "imeMode": 1
                            }
                        }
                    }
                },
                "defaultDataNode": {
                    "style": {
                        "themeFont": "Body"
                    }
                }
            },
            "rowHeaderData": {
                "defaultDataNode": {
                    "style": {
                        "themeFont": "Body"
                    }
                }
            },
            "colHeaderData": {
                "defaultDataNode": {
                    "style": {
                        "themeFont": "Body"
                    }
                }
            },
            "leftCellIndex": 0,
            "topCellIndex": 0,
            "selections": {
                "0": {
                    "row": 5,
                    "rowCount": 1,
                    "col": 10,
                    "colCount": 1
                },
                "length": 1
            },
            "rowOutlines": {
                "items": []
            },
            "columnOutlines": {
                "items": []
            },
            "cellStates": {},
            "states": {},
            "outlineColumnOptions": {},
            "autoMergeRangeInfos": [],
            "printInfo": {
                "paperSize": {
                    "width": 850,
                    "height": 1100,
                    "kind": 1
                }
            },
            "shapeCollectionOption": {
                "snapMode": 0
            }
        },
        "G$": {
            "startRange": {
                "row": 4,
                "rowCount": 1,
                "col": 10,
                "colCount": 1
            },
            "fillRange": {
                "row": 5,
                "rowCount": 3,
                "col": 10,
                "colCount": 1
            },
            "autoFillType": 0,
            "fillDirection": 3,
            "changesSheet6": []
        },
        "I$": {
            "row": 4,
            "rowCount": 4,
            "col": 10,
            "colCount": 1
        },
        "J$": 0,
        "N$": {
            "kj": {
                "name": "Sheet6",
                "isSelected": true,
                "activeRow": 5,
                "activeCol": 10,
                "frozenTrailingRowStickToEdge": true,
                "frozenTrailingColumnStickToEdge": true,
                "theme": "Office",
                "data": {
                    "dataTable": {
                        "0": {
                            "0": {
                                "style": {
                                    "hAlign": 1
                                }
                            },
                            "5": {
                                "value": 22
                            }
                        },
                        "2": {
                            "3": {
                                "value": 23
                            }
                        },
                        "4": {
                            "8": {
                                "value": 232
                            },
                            "10": {
                                "value": 232
                            }
                        },
                        "5": {
                            "10": {
                                "value": 232,
                                "style": {
                                    "hAlign": 3,
                                    "vAlign": 0,
                                    "themeFont": "Body",
                                    "imeMode": 1
                                }
                            }
                        },
                        "6": {
                            "10": {
                                "value": 232,
                                "style": {
                                    "hAlign": 3,
                                    "vAlign": 0,
                                    "themeFont": "Body",
                                    "imeMode": 1
                                }
                            }
                        },
                        "7": {
                            "10": {
                                "value": 232,
                                "style": {
                                    "hAlign": 3,
                                    "vAlign": 0,
                                    "themeFont": "Body",
                                    "imeMode": 1
                                }
                            }
                        }
                    },
                    "defaultDataNode": {
                        "style": {
                            "themeFont": "Body"
                        }
                    }
                },
                "rowHeaderData": {
                    "defaultDataNode": {
                        "style": {
                            "themeFont": "Body"
                        }
                    }
                },
                "colHeaderData": {
                    "defaultDataNode": {
                        "style": {
                            "themeFont": "Body"
                        }
                    }
                },
                "leftCellIndex": 0,
                "topCellIndex": 0,
                "selections": {
                    "0": {
                        "row": 5,
                        "rowCount": 1,
                        "col": 10,
                        "colCount": 1
                    },
                    "length": 1
                },
                "rowOutlines": {
                    "items": []
                },
                "columnOutlines": {
                    "items": []
                },
                "cellStates": {},
                "states": {},
                "outlineColumnOptions": {},
                "autoMergeRangeInfos": [],
                "printInfo": {
                    "paperSize": {
                        "width": 850,
                        "height": 1100,
                        "kind": 1
                    }
                },
                "shapeCollectionOption": {
                    "snapMode": 0
                }
            },
            "my": {
                "row": 5,
                "rowCount": 3,
                "col": 10,
                "colCount": 1
            },
            "ny": 2047,
            "oy": [
                [
                    {
                        "style": "{\"themeFont\":\"Body\"}"
                    }
                ],
                [
                    {
                        "style": "{\"themeFont\":\"Body\"}"
                    }
                ],
                [
                    {
                        "style": "{\"themeFont\":\"Body\"}"
                    }
                ]
            ],
            "Iu": []
        },
        "M$": {
            "kj": {
                "name": "Sheet6",
                "isSelected": true,
                "activeRow": 5,
                "activeCol": 10,
                "frozenTrailingRowStickToEdge": true,
                "frozenTrailingColumnStickToEdge": true,
                "theme": "Office",
                "data": {
                    "dataTable": {
                        "0": {
                            "0": {
                                "style": {
                                    "hAlign": 1
                                }
                            },
                            "5": {
                                "value": 22
                            }
                        },
                        "2": {
                            "3": {
                                "value": 23
                            }
                        },
                        "4": {
                            "8": {
                                "value": 232
                            },
                            "10": {
                                "value": 232
                            }
                        },
                        "5": {
                            "10": {
                                "value": 232,
                                "style": {
                                    "hAlign": 3,
                                    "vAlign": 0,
                                    "themeFont": "Body",
                                    "imeMode": 1
                                }
                            }
                        },
                        "6": {
                            "10": {
                                "value": 232,
                                "style": {
                                    "hAlign": 3,
                                    "vAlign": 0,
                                    "themeFont": "Body",
                                    "imeMode": 1
                                }
                            }
                        },
                        "7": {
                            "10": {
                                "value": 232,
                                "style": {
                                    "hAlign": 3,
                                    "vAlign": 0,
                                    "themeFont": "Body",
                                    "imeMode": 1
                                }
                            }
                        }
                    },
                    "defaultDataNode": {
                        "style": {
                            "themeFont": "Body"
                        }
                    }
                },
                "rowHeaderData": {
                    "defaultDataNode": {
                        "style": {
                            "themeFont": "Body"
                        }
                    }
                },
                "colHeaderData": {
                    "defaultDataNode": {
                        "style": {
                            "themeFont": "Body"
                        }
                    }
                },
                "leftCellIndex": 0,
                "topCellIndex": 0,
                "selections": {
                    "0": {
                        "row": 5,
                        "rowCount": 1,
                        "col": 10,
                        "colCount": 1
                    },
                    "length": 1
                },
                "rowOutlines": {
                    "items": []
                },
                "columnOutlines": {
                    "items": []
                },
                "cellStates": {},
                "states": {},
                "outlineColumnOptions": {},
                "autoMergeRangeInfos": [],
                "printInfo": {
                    "paperSize": {
                        "width": 850,
                        "height": 1100,
                        "kind": 1
                    }
                },
                "shapeCollectionOption": {
                    "snapMode": 0
                }
            },
            "my": {
                "row": 5,
                "rowCount": 3,
                "col": 10,
                "colCount": 1
            },
            "ny": 2047,
            "oy": [
                [
                    {
                        "value": 232,
                        "style": "{\"themeFont\":\"Body\"}"
                    }
                ],
                [
                    {
                        "value": 232,
                        "style": "{\"themeFont\":\"Body\"}"
                    }
                ],
                [
                    {
                        "value": 232,
                        "style": "{\"themeFont\":\"Body\"}"
                    }
                ]
            ],
            "Iu": [
                {
                    "row": 5,
                    "col": 10
                },
                {
                    "row": 6,
                    "col": 10
                },
                {
                    "row": 7,
                    "col": 10
                }
            ]
        }
    },
    "changesSheet6": [
        [
            [
                "sheetModels",
                3,
                "dataTable",
                5,
                10,
                "style"
            ],
            null
        ],
        [
            [
                "sheetModels",
                3,
                "dataTable",
                5,
                10,
                "value"
            ],
            null
        ],
        {
            "sheetArea": 3,
            "type": "updateDirty",
            "row": 5,
            "col": 10,
            "isEmptyRow": true
        },
        [
            [
                "sheetModels",
                3,
                "dataTable",
                5,
                10,
                "hyperlink"
            ],
            null
        ],
        [
            [
                "sheetModels",
                3,
                "dataTable",
                6,
                10,
                "style"
            ],
            null
        ],
        [
            [
                "sheetModels",
                3,
                "dataTable",
                6,
                10,
                "value"
            ],
            null
        ],
        {
            "sheetArea": 3,
            "type": "updateDirty",
            "row": 6,
            "col": 10,
            "isEmptyRow": true
        },
        [
            [
                "sheetModels",
                3,
                "dataTable",
                6,
                10,
                "hyperlink"
            ],
            null
        ],
        [
            [
                "sheetModels",
                3,
                "dataTable",
                7,
                10,
                "style"
            ],
            null
        ],
        [
            [
                "sheetModels",
                3,
                "dataTable",
                7,
                10,
                "value"
            ],
            null
        ],
        {
            "sheetArea": 3,
            "type": "updateDirty",
            "row": 7,
            "col": 10,
            "isEmptyRow": true
        },
        [
            [
                "sheetModels",
                3,
                "dataTable",
                7,
                10,
                "hyperlink"
            ],
            null
        ],
        [
            [
                "selectionModel",
                "selections"
            ],
            [
                {
                    "row": 4,
                    "rowCount": 1,
                    "col": 10,
                    "colCount": 1
                }
            ]
        ],
        [
            [
                "selectionModel",
                "activeSelectedRangeIndex"
            ],
            0
        ],
        [
            [
                "selectionModel",
                "selections"
            ],
            []
        ],
        [
            [
                "selectionModel",
                "activeSelectedRangeIndex"
            ],
            -1
        ]
    ],
    "sheetId": 2
}
我用命令**,监听到的fill命令,复制这个命令直接执行,为什么不能实现呢?

最佳答案

查看完整内容

这个属于在线表格编辑器的命令,在线表格编辑器的命令是内置的,没有API暴露。在线表格编辑器本身的功能都是基于SpreadJS来的,你可以自己去模拟实现该功能,比如mergeCenter就是合并居中,自己实现一个合并居中即可。

9 个回复

倒序浏览
最佳答案
最佳答案
Clark.Pan讲师达人认证 悬赏达人认证 SpreadJS 开发认证
超级版主   /  发表于:2021-10-26 10:24:26
来自 8#
这个属于在线表格编辑器的命令,在线表格编辑器的命令是内置的,没有API暴露。在线表格编辑器本身的功能都是基于SpreadJS来的,你可以自己去模拟实现该功能,比如mergeCenter就是合并居中,自己实现一个合并居中即可。
回复 使用道具 举报
Derrick.Jiao讲师达人认证 悬赏达人认证 SpreadJS 开发认证
论坛元老   /  发表于:2021-10-26 11:15:06
2#
这个命令执行的是一个拖拽填充的功能,也就是下拉填充这样一个动作。如果对应的区域没有数据,那么填充上去也只会是空白。
image.png23474730.png
回复 使用道具 举报
Barry
中级会员   /  发表于:2021-10-26 11:32:09
3#
Derrick.Jiao 发表于 2021-10-26 11:15
这个命令执行的是一个拖拽填充的功能,也就是下拉填充这样一个动作。如果对应的区域没有数据,那么填充上去 ...

对应区域是有数据的,但还是不会填充
回复 使用道具 举报
Derrick.Jiao讲师达人认证 悬赏达人认证 SpreadJS 开发认证
论坛元老   /  发表于:2021-10-26 12:26:16
4#
Barry 发表于 2021-10-26 11:32
对应区域是有数据的,但还是不会填充

像这种带有大量内部属性的命令结构,不推荐直接调用,容易出现一一些难以定位的问题或者是某个属性不一致就会出现执行不了的情况。建议参考下面的代码利用我们封装好的命令实现。 image.png686062926.png
回复 使用道具 举报
Barry
中级会员   /  发表于:2021-10-26 13:42:36
5#
Derrick.Jiao 发表于 2021-10-26 12:26
像这种带有大量内部属性的命令结构,不推荐直接调用,容易出现一一些难以定位的问题或者是某个属性不一致 ...

你好,我是通过spread.commandManager().addListener('anyscLicenser', function(...args) {}来监听并获取的操作命令,所以拿到的就是上面那样带有大量内部属性的,请问有方法在监听的时候让拿到的触发命令是你们封装好的那种格式吗?
回复 使用道具 举报
Clark.Pan讲师达人认证 悬赏达人认证 SpreadJS 开发认证
超级版主   /  发表于:2021-10-26 13:58:51
6#
addListener只是为了用来获取当前触发的命令名称,而不是说直接执行
回复 使用道具 举报
Barry
中级会员   /  发表于:2021-10-26 14:06:21
7#
Clark.Pan 发表于 2021-10-26 13:58
addListener只是为了用来获取当前触发的命令名称,而不是说直接执行

好的,那请问像Designer.mergeCenter这样的命令,api文档里并没有这个命令,我可以拿到命令的配置项并去执行吗?或者说需要我自己用其他api去实现这个命令的功能
回复 使用道具 举报
Barry
中级会员   /  发表于:2021-10-26 15:29:54
9#
Clark.Pan 发表于 2021-10-26 15:08
这个属于在线表格编辑器的命令,在线表格编辑器的命令是内置的,没有API暴露。在线表格编辑器本身的功能都 ...

你好,我在fill命令可以成功执行了,但无论当前选中的单元格是哪一个,执行fill命令时,选中单元格都会跳到fill时选中的区域,这个问题可以解决吗?
回复 使用道具 举报
Derrick.Jiao讲师达人认证 悬赏达人认证 SpreadJS 开发认证
论坛元老   /  发表于:2021-10-26 15:52:46
10#
Barry 发表于 2021-10-26 15:29
你好,我在fill命令可以成功执行了,但无论当前选中的单元格是哪一个,执行fill命令时,选中单元格都会跳 ...

这个是正常现象,就像你在使用鼠标下拉填充的时候,填充完成选中的区域就是你填充的区域。如需设置其他选中区域,请在执行完填充后重新setSelection
回复 使用道具 举报
您需要登录后才可以回帖 登录 | 立即注册
返回顶部