← 返回
开发者工具

Operate Web Apps Built by Forguncy (aka 活字格)

Provides functionality to interact with SpreadJS tables in the web applications built by Forguncy (aka 活字格), specifically for extracting table data and colum...
Provides functionality to interact with SpreadJS tables in the web applications built by Forguncy (aka 活字格), specifically for extracting table data and colum...
kadbbz
开发者工具 clawhub v1.0.2 1 版本 100000 Key: 无需
★ 0
Stars
📥 499
下载
💾 8
安装
1
版本
#latest

概述

Forguncy Web Operations (forguncy-web-operator)

This skill allows you to extract data and headers from SpreadJS tables within the web applications built by Forguncy (aka 活字格).

How to use

The following JavaScript snippets can be executed in the browser context using the browser.act tool with kind: "evaluate" to retrieve data from a SpreadJS table.

Dynamically Get Table Name (fgcname)

First, you need to identify the fgcname of the SpreadJS table. You can find this by inspecting the DOM or using a JavaScript snippet like this to find elements with fgc-uielement="listview" and extract their fgcname:

(function() {
    const listViews = document.querySelectorAll('[fgc-uielement="listview"]');
    let fgcNames = [];
    listViews.forEach(lv => {
        if (lv.hasAttribute('fgcname')) {
            fgcNames.push(lv.getAttribute('fgcname'));
        }
    });
    return fgcNames;
})()

Once you have the fgcname (e.g., "表格1"), you can use it in the following functions.

Get Table Data

To get the full table data in CSV format (rows separated by '\\r', columns by ','), replace YOUR_TABLE_FGCNAME with the actual fgcname you found:

(function() {
    const tableName = "YOUR_TABLE_FGCNAME"; // Replace with the actual fgcname, e.g., "表格1"
    var sheet = Forguncy.Page.getListView(tableName).getControl().getActiveSheet();
    return sheet.getCsv(0,0,sheet.getRowCount(), sheet.getColumnCount(),"\r",",");
})()

Get Column Headers

To get the column headers, assuming there are 2 header rows (adjust headerRowCount if necessary), replace YOUR_TABLE_FGCNAME with the actual fgcname:

(function() {
    const tableName = "YOUR_TABLE_FGCNAME"; // Replace with the actual fgcname, e.g., "表格1"
    var sheet = Forguncy.Page.getListView(tableName).getControl().getActiveSheet();
    var headerRowCount = sheet.getRowCount(GC.Spread.Sheets.SheetArea.colHeader); 
    var headers = [];
    for (let r = 0; r < headerRowCount; r++) {
        var rowHeaders = [];
        for (let c = 0; c < sheet.getColumnCount(); c++) {
            rowHeaders.push(sheet.getValue(r, c, GC.Spread.Sheets.SheetArea.colHeader));
        }
        headers.push(rowHeaders);
    }
    return headers;
})()

Remember to pass the targetId obtained from a browser.open or browser.snapshot call when executing these scripts.

版本历史

共 1 个版本

  • v1.0.2 当前
    2026-03-30 00:35 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

developer-tools

CodeConductor.ai

larsonreever
AI驱动平台,提供快速全栈开发、智能体、工作流自动化及低代码AI集成的可扩展产品创建。
★ 66 📥 179,904
productivity

多用户隔离型长期记忆 Multi-user Long Term Memory

kadbbz
为多个用户创建和管理独立的长期记忆文件,记录偏好和上下文并按用户名隔离存储。
★ 5 📥 2,486
developer-tools

Github

steipete
使用 `gh` CLI 与 GitHub 交互,通过 `gh issue`、`gh pr`、`gh run` 和 `gh api` 管理议题、PR、CI 运行及高级查询。
★ 668 📥 323,875